question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GZIP compression does not work for responses to POST requests.

See original GitHub issue

Wiremock registers GzipFilter with default configuration:

com.github.tomakehurst.wiremock.jetty9.JettyHttpServer

mockServiceContext.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD));

But by default the aforementioned filter handles only GET request.

org.eclipse.jetty.servlets.GzipFilter

// public void init
tmp=filterConfig.getInitParameter("methods");
        if (tmp!=null)
        {
            StringTokenizer tok = new StringTokenizer(tmp,",",false);
            while (tok.hasMoreTokens())
                _methods.add(tok.nextToken().trim().toUpperCase(Locale.ENGLISH));
        }
        else
            _methods.add(HttpMethod.GET.asString());

// public void doFilter()
if (!_methods.contains(request.getMethod()) || isExcludedPath(requestURI))
        {
            super.doFilter(request,response,chain);
            return;
        }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tomakehurstcommented, Jun 24, 2020

It should happen automatically provided you’re sending Accept-Encoding:gzip in the request.

1reaction
tomakehurstcommented, Jun 24, 2020

@stelarelas yes, I should have closed this issue ages ago, as it’s been fixed.

It sounds to me like you’re trying to send a non-gzipped request with a gzip header, so I’d expect it to throw an exception in that instance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GZIP compression does not work for responses to POST ...
It should happen automatically provided you're sending Accept-Encoding:gzip in the request. 1
Read more >
Why HTTP request compression is almost never supported
The client sends an HTTP POST request to the server with a Accept-Encoding: gzip header set to indicate that it supports gzip compression....
Read more >
Compressing HTTP Post Data sent from browser
Will the browser automatically gzip-encode your data for you? The short answer is no. The long answer is that some user-agents can do...
Read more >
Is it possible to enable http compression for requests?
To PUT data to the server compressed you must compress the request body and set the Content-Encoding: gzip header. The header itself must...
Read more >
Receive an API response with a compressed payload
When making a request on a compression-enabled API, the client can choose to receive a compressed response payload of a specific format by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found