More than one wildcard directive in accept-encoding header causes fall back to br
not gzip
#187
Closed
2 tasks done
br
not gzip
#187
Prerequisites
Fastify version
3.22.0
Plugin version
3.6.0
Node.js version
14.18.1
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10
Description
In the documentation it states that if the
*
wildcard directive is used in theAccept-Encoding
request header then the plugin will usegzip
. However, if multiple wildcard directives are included in theAccept-Encoding
request header then it usesbr
.I believe this is due to the following line only replacing the first occurrence of a
*
:fastify-compress/index.js
Line 451 in cf98280
Suggested fix:
.replace(/\*/g, 'gzip')
This also occurs in
fastify-static
:https://github.com/fastify/fastify-static/blob/master/index.js#L436
Happy to open a PR for this.
Steps to Reproduce
Request:
Response:
Request:
Response:
Expected Behavior
Content-Encoding
value should be gzip.The text was updated successfully, but these errors were encountered: