use of org.springframework.mock.http.server.reactive.test.MockServerHttpRequest in project spring-framework by spring-projects.
the class CorsUtilsTests method isCorsRequest.
@Test
public void isCorsRequest() {
MockServerHttpRequest request = get("/").header(HttpHeaders.ORIGIN, "http://domain.com").build();
assertTrue(CorsUtils.isCorsRequest(request));
}
use of org.springframework.mock.http.server.reactive.test.MockServerHttpRequest in project spring-framework by spring-projects.
the class CorsUtilsTests method isPreFlightRequest.
@Test
public void isPreFlightRequest() {
MockServerHttpRequest request = options("/").header(HttpHeaders.ORIGIN, "http://domain.com").header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET").build();
assertTrue(CorsUtils.isPreFlightRequest(request));
}
use of org.springframework.mock.http.server.reactive.test.MockServerHttpRequest in project spring-framework by spring-projects.
the class CorsUtilsTests method isNotCorsRequest.
@Test
public void isNotCorsRequest() {
MockServerHttpRequest request = get("/").build();
assertFalse(CorsUtils.isCorsRequest(request));
}
use of org.springframework.mock.http.server.reactive.test.MockServerHttpRequest in project spring-framework by spring-projects.
the class WebHttpHandlerBuilderTests method orderedWebExceptionHandlerBeans.
// SPR-15074
@Test
public void orderedWebExceptionHandlerBeans() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(OrderedExceptionHandlerBeanConfig.class);
context.refresh();
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build();
MockServerHttpRequest request = MockServerHttpRequest.get("/").build();
MockServerHttpResponse response = new MockServerHttpResponse();
httpHandler.handle(request, response).blockMillis(5000);
assertEquals("ExceptionHandlerB", response.getBodyAsString().blockMillis(5000));
}
use of org.springframework.mock.http.server.reactive.test.MockServerHttpRequest in project spring-framework by spring-projects.
the class WebHttpHandlerBuilderTests method configWithoutFilters.
@Test
public void configWithoutFilters() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(NoFilterConfig.class);
context.refresh();
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(context).build();
MockServerHttpRequest request = MockServerHttpRequest.get("/").build();
MockServerHttpResponse response = new MockServerHttpResponse();
httpHandler.handle(request, response).blockMillis(5000);
assertEquals("handled", response.getBodyAsString().blockMillis(5000));
}
Aggregations