Enable rendering as HAL FORMS.
We're now registering an HttpMessageConverter to render requests for HAL FORMS using the HalFormsConfiguration present in the application. We're currently not adding any affordances yet. The change solely enables user code to add affordances explicitly, e.g. via RepresentationModelProcessor implementations. Fixes: #1991.
This commit is contained in:
@@ -45,6 +45,7 @@ import org.springframework.hateoas.IanaLinkRelations;
|
||||
import org.springframework.hateoas.Link;
|
||||
import org.springframework.hateoas.LinkRelation;
|
||||
import org.springframework.hateoas.Links;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.hateoas.server.LinkRelationProvider;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
@@ -731,6 +732,14 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(content.read("$.calculatedName", String.class)).isEqualTo("calculated-put");
|
||||
}
|
||||
|
||||
@Test // #1991
|
||||
public void answersToHalFormsRequests() throws Exception {
|
||||
|
||||
mvc.perform(get("/")
|
||||
.accept(MediaTypes.HAL_FORMS_JSON))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
private List<Link> preparePersonResources(Person primary, Person... persons) throws Exception {
|
||||
|
||||
Link peopleLink = client.discoverUnique(LinkRelation.of("people"));
|
||||
|
||||
Reference in New Issue
Block a user