seanmonstar / reqwest

An easy and powerful Rust HTTP Client
https://docs.rs/reqwest
Apache License 2.0
9.75k stars 1.1k forks source link

Gzip *compression* in addition to decompression? #1217

Open wbrickner opened 3 years ago

wbrickner commented 3 years ago

Hello,

I'm sending potentially thousands of JSON objects in a list, and they're nearly identical.

Without gzip the size becomes large, and I'd like a way to turn on gzip request body compression.

Is this supported? I only see gzip decompression options in the client builder.

Thanks.

seanmonstar commented 3 years ago

Nope, it's not currently supported. If you have the bytes already, you could pass them through a gzip function before sending in the requests...

As for adding the functionality to reqwest, I'd suggest canvassing what other libraries (even in other languages) provide.

rbtcollins commented 2 years ago

+1 for being able to do this, mixpanel is an API where compressing requests is very useful. As it wants JSON, the ergonomics of reqwest suffer a long - can't use json(..) have to encode manually and then drop the bytes in by hand.