-
First of all, thank you for supporting this gem, it's so useful! I'm a bit lost and perhaps someone could clarify this for me. I've been using Faraday 1 with faraday_middleware, specifically I've added a plugin that was enabling GZip support. Here's the relevant code: https://github.com/lokalise/ruby-lokalise-api/blob/master/lib/ruby-lokalise-api/connection.rb#L9 It worked fine but now this middleware is deprecated. The documentation states that the GZip plugin is not needed when using NetHttp adapter as it will add the "accept-encoding" header and will automatically decompress the response. However, I don't see this happening: after I've removed the GZip plugin and updated to Faraday 2 my tests started to fail because the response is not decompressed: Here's a simple example:
Then I'm trying to:
When inspecting
So, the only header I see is "user-agent" though I expected to find "accept-encoding" here as well. I'm pretty sure I'm missing a point here. How should it work? P.S. I've just tried to use HTTPx adapter and it worked fine |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @bodrovis and thanks for reaching out! If you'd like to keep supporting all adapters, then the |
Beta Was this translation helpful? Give feedback.
Hi @bodrovis and thanks for reaching out!
This is indeed interesting because
Net::HTTP
officially supports compression out of the box.I'm honestly unsure as to why this isn't the case for you, but I can only imagine this is due to the lack of some necessary header (that the server should return?) 🤔.
If you'd like to keep supporting all adapters, then the
gzip
could be gemified into its own gem. If you're interested, the process is actually quite easy thanks to the faraday-middleware-template repository. The main reason this hasn't been done it is because we didn't consider the middleware much useful anymore, but if someone would like to take the lead in making a gem out of it compatible …