title: Disable Transfer-Encoding chunked in wiremock standalone server
body: <p>I am running wiremock standalone using wiremockserver.</p>
  <p>The application does not work in PCF because of the header <code>Transfer-Encoding: chunked</code>.</p>
  <p>(If this header is present then in PCF I get the error <code>502 Bad Gateway: Registered endpoint failed to handle the request.</code> and in headers <code>x-cf-routererror endpoint_failure endpoint_failure (net/http: http/1.x transport connection broken: too many transfer encodings: [&quot;chunked&quot; &quot;chunked&quot;])</code>.)</p>
  <p>I don't want this header so I tried to disable the chunked encoding in wiremock:</p>
  <pre><code>@SpringBootApplication
  public class MockApplication implements CommandLineRunner {
  
      private final int serverPort;
  
      private final ResourceLoader resourceLoader;
  
      public MockApplication(@Value(&quot;${server.port}&quot;) final int serverPort, final ResourceLoader resourceLoader) {
          this.serverPort = serverPort;
          this.resourceLoader = resourceLoader;
      }
  
      public static void main(final String[] args) {
          SpringApplication.run(MockApplication.class, args); //start springboot application
      }
  
      @Override
      public void run(final String... args) {
          final WireMockServer wireMockServer = new WireMockServer(options().port(serverPort+2)
                      .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.NEVER)
                      .extensions(new ResponseTemplateTransformer(false)));
          wireMockServer.start(); //start wiremock server
      }
  </code></pre>
  <p>Spring boot app posts data to wiremock app using restTemplate. sample request:</p>
  <pre><code>{
      &quot;request&quot;: {
          &quot;url&quot;: &quot;/some-wiremock-endpoint&quot;,
          &quot;method&quot;: &quot;POST&quot;,
          &quot;bodyPatterns&quot;: [
              {
                  &quot;contains&quot;: &quot;12345&quot;
              }
          ]
      },
      &quot;response&quot;: {
          &quot;status&quot;: 200,
          &quot;headers&quot;: null,
          &quot;body&quot;: &quot;{\&quot;books\&quot;:[{\&quot;book_number\&quot;:\&quot;12345\&quot;,\&quot;book_code\&quot;:\&quot;FICTION\&quot;}]}&quot;
      }
  }
  </code></pre>
  <p>When the customer uses <code>http://localhost:8080/some-wiremock-endpoint</code> then the springboot app connects to wiremock url <code>http://localhost:8082/some-wiremock-endpoint</code> to retrieve the stub data from wiremock server:</p>
  <pre><code>ResponseEntity&lt;String&gt; exchange = null;
          try {
              exchange = restTemplate.exchange(wiremockUrlAndUri, HttpMethod.POST, request, String.class);
  //http://localhost:8082/some-wiremock-endpoint is the wiremockUrlAndUri value in this case.
  </code></pre>
  <p>When I see <code>exchange.getHeaders()</code> then I still see <code>Transfer-Encoding: chunked</code> header.</p>
  <p>How do I disable this header in Springboot application?</p>