use of org.springframework.http.server.ServletServerHttpRequest in project spring-boot by spring-projects.
the class HttpHeaderAccessManagerTests method setup.
@Before
public void setup() {
this.request = new MockHttpServletRequest("GET", "/");
this.serverRequest = new ServletServerHttpRequest(this.request);
this.manager = new HttpHeaderAccessManager(HEADER, SECRET);
}
use of org.springframework.http.server.ServletServerHttpRequest in project spring-boot by spring-projects.
the class UrlHandlerMapperTests method handlesMatchedUrl.
@Test
public void handlesMatchedUrl() throws Exception {
UrlHandlerMapper mapper = new UrlHandlerMapper("/tunnel", this.handler);
HttpServletRequest servletRequest = new MockHttpServletRequest("GET", "/tunnel");
ServerHttpRequest request = new ServletServerHttpRequest(servletRequest);
assertThat(mapper.getHandler(request)).isEqualTo(this.handler);
}
use of org.springframework.http.server.ServletServerHttpRequest in project spring-boot by spring-projects.
the class HttpTunnelPayloadTests method getWithData.
@Test
public void getWithData() throws Exception {
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setContent("hello".getBytes());
servletRequest.addHeader("x-seq", 123);
HttpInputMessage request = new ServletServerHttpRequest(servletRequest);
HttpTunnelPayload payload = HttpTunnelPayload.get(request);
assertThat(payload.getSequence()).isEqualTo(123L);
assertThat(getData(payload)).isEqualTo("hello".getBytes());
}
use of org.springframework.http.server.ServletServerHttpRequest in project spring-boot by spring-projects.
the class HttpTunnelPayloadTests method getNoData.
@Test
public void getNoData() throws Exception {
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
HttpInputMessage request = new ServletServerHttpRequest(servletRequest);
HttpTunnelPayload payload = HttpTunnelPayload.get(request);
assertThat(payload).isNull();
}
use of org.springframework.http.server.ServletServerHttpRequest in project spring-boot by spring-projects.
the class HttpTunnelPayloadTests method getWithMissingHeader.
@Test
public void getWithMissingHeader() throws Exception {
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setContent("hello".getBytes());
HttpInputMessage request = new ServletServerHttpRequest(servletRequest);
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Missing sequence header");
HttpTunnelPayload.get(request);
}
Aggregations