use of com.github.tomakehurst.wiremock.testsupport.WireMockResponse in project wiremock by wiremock.
the class StandaloneAcceptanceTest method shouldNotSend302WhenPathIsDirAndTrailingSlashNotPresent.
@Test
public void shouldNotSend302WhenPathIsDirAndTrailingSlashNotPresent() {
writeFileToFilesDir("json/wire & mock directory/index.json", "{ \"key\": \"index page value\" }");
startRunner();
WireMockResponse response = testClient.get("/json/wire%20&%20mock%20directory");
assertThat(response.statusCode(), is(200));
assertThat(response.content(), is("{ \"key\": \"index page value\" }"));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockResponse in project wiremock by wiremock.
the class HttpsBrowserProxyAcceptanceTest method canProxyHttpsInBrowserHttpsProxyMode.
@Test
public void canProxyHttpsInBrowserHttpsProxyMode() throws Exception {
target.stubFor(get(urlEqualTo("/whatever")).willReturn(aResponse().withBody("Got it")));
WireMockResponse response = testClient.getViaProxy(target.url("/whatever"), proxy.getHttpsPort(), "https");
assertThat(response.content(), is("Got it"));
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockResponse in project wiremock by wiremock.
the class HttpsBrowserProxyAcceptanceTest method trustsTargetIfTrustStoreContainsItsCertificate.
@Test
public void trustsTargetIfTrustStoreContainsItsCertificate() {
WireMockServer scepticalProxy = new WireMockServer(wireMockConfig().dynamicPort().enableBrowserProxying(true).trustStorePath(TRUST_STORE_PATH).trustStorePassword(TRUST_STORE_PASSWORD));
try {
scepticalProxy.start();
target.stubFor(get(urlEqualTo("/whatever")).willReturn(aResponse().withBody("Got it")));
WireMockResponse response = testClient.getViaProxy(target.url("/whatever"), scepticalProxy.port());
assertThat(response.statusCode(), is(200));
assertThat(response.content(), is("Got it"));
} finally {
scepticalProxy.stop();
}
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockResponse in project wiremock by wiremock.
the class HttpsBrowserProxyAcceptanceTest method rejectsUntrustedTarget.
@Test
public void rejectsUntrustedTarget() {
WireMockServer scepticalProxy = new WireMockServer(wireMockConfig().dynamicPort().enableBrowserProxying(true));
try {
scepticalProxy.start();
target.stubFor(get(urlEqualTo("/whatever")).willReturn(aResponse().withBody("Got it")));
WireMockResponse response = testClient.getViaProxy(target.url("/whatever"), scepticalProxy.port());
assertThat(response.statusCode(), is(500));
} finally {
scepticalProxy.stop();
}
}
use of com.github.tomakehurst.wiremock.testsupport.WireMockResponse in project wiremock by wiremock.
the class MappingsAcceptanceTest method getResponseAndAssert404Status.
private void getResponseAndAssert404Status(String url) {
WireMockResponse response = testClient.get(url);
assertThat(response.statusCode(), is(404));
}
Aggregations