GZIP compression does not work for responses to POST requests.
See original GitHub issueWiremock 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:
- Created 6 years ago
- Comments:23 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It should happen automatically provided you’re sending
Accept-Encoding:gzip
in the request.@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.