Examples of firstHeader()


Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

        .proxiedFrom(TARGET_SERVICE_BASE_URL)));
   
    WireMockResponse response = testClient.get("/proxied/resource?param=value");
   
    assertThat(response.content(), is("Proxied content"));
    assertThat(response.firstHeader("Content-Type"), is("text/plain"));
  }
 
  @Test
  public void successfullyPostsResponseToOtherServiceViaProxy() {
        initWithDefaultConfig();
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

                        .withHeader("X-Additional-Header", "Yep")
                        .proxiedFrom(TARGET_SERVICE_BASE_URL)));

        WireMockResponse response = testClient.get("/extra/headers");

        assertThat(response.firstHeader("Content-Type"), is("text/plain"));
        assertThat(response.firstHeader("X-Additional-Header"), is("Yep"));
    }

    @Test
    public void doesNotDuplicateCookieHeaders() {
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

                        .proxiedFrom(TARGET_SERVICE_BASE_URL)));

        WireMockResponse response = testClient.get("/extra/headers");

        assertThat(response.firstHeader("Content-Type"), is("text/plain"));
        assertThat(response.firstHeader("X-Additional-Header"), is("Yep"));
    }

    @Test
    public void doesNotDuplicateCookieHeaders() {
        initWithDefaultConfig();
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

    writeFileToFilesDir("test-1.xml", "<content>Blah</content>");
    startRunner();
    WireMockResponse response = testClient.get("/test-1.xml");
    assertThat(response.statusCode(), is(200));
    assertThat(response.content(), is("<content>Blah</content>"));
    assertThat(response.firstHeader("Content-Type"), is("application/xml"));
  }
 
  @Test
  public void servesFileFromSpecifiedRecordingsPath() {
    String differentRoot = FILE_SOURCE_ROOT + separator + "differentRoot";
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

    writeFile(differentRoot + separator + underFiles("test-1.xml"), "<content>Blah</content>");
    startRunner("--root-dir", differentRoot);
    WireMockResponse response = testClient.get("/test-1.xml");
    assertThat(response.statusCode(), is(200));
    assertThat(response.content(), is("<content>Blah</content>"));
    assertThat(response.firstHeader("Content-Type"), is("application/xml"));
  }

  @Test
  public void servesFileAsJsonWhenNoFileExtension() {
    writeFileToFilesDir("json/12345", "{ \"key\": \"value\" }");
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

    writeFileToFilesDir("json/12345", "{ \"key\": \"value\" }");
    startRunner();
    WireMockResponse response = testClient.get("/json/12345");
    assertThat(response.statusCode(), is(200));
    assertThat(response.content(), is("{ \"key\": \"value\" }"));
    assertThat(response.firstHeader("Content-Type"), is("application/json"));
  }
 
  @Test
  public void shouldNotSend302WhenPathIsDirAndTrailingSlashNotPresent() {
      writeFileToFilesDir("json/wire & mock directory/index.json", "{ \"key\": \"index page value\" }");
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

    writeFileToFilesDir("json/23456/index.json", "{ \"key\": \"new value\" }");
    startRunner();
    WireMockResponse response = testClient.get("/json/23456/");
    assertThat(response.statusCode(), is(200));
    assertThat(response.content(), is("{ \"key\": \"new value\" }"));
    assertThat(response.firstHeader("Content-Type"), is("application/json"));
  }
 
  @Test
  public void servesXmlIndexFileWhenTrailingSlashPresent() {
    writeFileToFilesDir("json/34567/index.xml", "<blob>BLAB</blob>");
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

    writeFileToFilesDir("json/34567/index.xml", "<blob>BLAB</blob>");
    startRunner();
    WireMockResponse response = testClient.get("/json/34567/");
    assertThat(response.statusCode(), is(200));
    assertThat(response.content(), is("<blob>BLAB</blob>"));
    assertThat(response.firstHeader("Content-Type"), is("application/xml"));
  }
 
  @Test
  public void doesNotServeFileFromFilesDirWhenNotGET() {
    writeFileToFilesDir("json/should-not-see-this.json", "{}");
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

   
    WireMockResponse response = testClient.get("/a/registered/resource");
   
    assertThat(response.statusCode(), is(401));
    assertThat(response.content(), is("Not allowed!"));
    assertThat(response.firstHeader("Content-Type"), is("text/plain"));
  }
 
  @Test
  public void mappingWithStatusOnlyResponseIsCreatedAndReturned() {
    testClient.addResponse(MappingJsonSamples.STATUS_ONLY_MAPPING_REQUEST);
View Full Code Here

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockResponse.firstHeader()

   
    WireMockResponse response = testClient.get("/a/registered/resource");
   
    assertThat(response.statusCode(), is(401));
    assertThat(response.content(), is("Not allowed!"));
    assertThat(response.firstHeader("Content-Type"), is("text/plain"));
  }
 
  @Test
  public void mappingWithUrlContainingQueryParameters() {
    stubFor(get(urlEqualTo("/search?name=John&postcode=N44LL")).willReturn(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.