use of org.springframework.http.MediaType.TEXT_XML_VALUE in project spring-framework by spring-projects.
the class RequestPredicatesTests method accept.
@Test
void accept() {
MediaType json = MediaType.APPLICATION_JSON;
RequestPredicate predicate = RequestPredicates.accept(json);
ServerRequest request = initRequest("GET", "/path", req -> req.addHeader("Accept", json.toString()));
assertThat(predicate.test(request)).isTrue();
request = initRequest("GET", "", req -> req.addHeader("Accept", TEXT_XML_VALUE));
assertThat(predicate.test(request)).isFalse();
}
Aggregations