seanmonstar/warp

Decompression filters

cmackenzie1 opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
For outgoing responses, one can use the .with(warp::compression::gzip()) to automatically encode the response. The inverse should also be possible - decompressing incoming payloads.

Looking for gzip support primarily.

Describe the solution you'd like

Ideally the very same filters for compressing outgoing responses could also be used for decompressing incoming responses. They impl should use Content-Encoding header and be a no-op if the data is not compressed. Basically, should behave like a optional middleware in a classic stack.

let upload = warp::path("upload")
  .and(warp::post())
  .and_maybe(warp::compression::gzip())
  .and(warp::body::bytes())
  .map(|body: bytes::Bytes| ... do something)

Describe alternatives you've considered
Decompressing the warp::body::bytes() manually.

Additional context
Nothing to add here :)

@SeanChao or @tottoto I would love to pick this up but I would kindly need some pointers. See linked PR.