use of com.github.tomakehurst.wiremock.http.BasicResponseRenderer in project styx by ExpediaGroup.
the class WiremockResponseConverterTest method convertsResponseWithBody.
@Test
public void convertsResponseWithBody() {
ResponseDefinition response = new ResponseDefinition(HTTP_OK, "{ \"count\" : 0, \"requestJournalDisabled\" : false}");
response.setHeaders(new HttpHeaders(httpHeader("Transfer-Encoding", "chunked"), httpHeader("Content-Type", "application/json")));
HttpResponse styxResponse = toStyxResponse(new BasicResponseRenderer().render(response));
assertThat(styxResponse.status(), is(OK));
Map<String, String> actual = headersAsMap(styxResponse);
assertThat(actual, is(Map.of("Transfer-Encoding", "chunked", "Content-Type", "application/json")));
assertThat(styxResponse.bodyAs(UTF_8), is("{ \"count\" : 0, \"requestJournalDisabled\" : false}"));
assertThat(headerCount(styxResponse.headers()), is(2));
}
use of com.github.tomakehurst.wiremock.http.BasicResponseRenderer in project styx by ExpediaGroup.
the class WiremockResponseConverterTest method convertsCreatedResponse.
@Test
public void convertsCreatedResponse() {
ResponseDefinition created = ResponseDefinition.created();
Response render = new BasicResponseRenderer().render(created);
HttpResponse styxResponse = toStyxResponse(render);
assertThat(styxResponse.status(), is(CREATED));
assertThat(styxResponse.bodyAs(UTF_8), is(""));
assertThat(headerCount(styxResponse.headers()), is(0));
}
use of com.github.tomakehurst.wiremock.http.BasicResponseRenderer in project wiremock by wiremock.
the class JettyHttpServerTest method init.
@BeforeEach
public void init() {
Admin admin = Mockito.mock(Admin.class);
adminRequestHandler = new AdminRequestHandler(AdminRoutes.defaults(), admin, new BasicResponseRenderer(), new NoAuthenticator(), false, Collections.<RequestFilter>emptyList());
stubRequestHandler = new StubRequestHandler(Mockito.mock(StubServer.class), Mockito.mock(ResponseRenderer.class), admin, Collections.<String, PostServeAction>emptyMap(), Mockito.mock(RequestJournal.class), Collections.<RequestFilter>emptyList(), false);
}
use of com.github.tomakehurst.wiremock.http.BasicResponseRenderer in project wiremock by wiremock.
the class AdminRequestHandlerTest method init.
@BeforeEach
public void init() {
httpResponder = new MockHttpResponder();
handler = new AdminRequestHandler(AdminRoutes.defaults(), admin, new BasicResponseRenderer(), new NoAuthenticator(), false, Collections.<RequestFilter>emptyList());
}
Aggregations