-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose compression level on CompressionLayer #245
Comments
PRs are welcome! |
I will try look into it, not sure i can provide code that are up to par though haha. |
Happy to help with feedback! |
@Nehliin @davidpdrsn Do you have any design ideas? How propagate compression level to the encoders? |
Haven't looked into the details yet. Can look at it next week sometime |
@Nehliin Thank you |
I think a builder method on CompressionLayer::new().level(the_level) is fine. I think we can copy https://docs.rs/async-compression/latest/async_compression/enum.Level.html into tower-http and internally map between them, to not expose things from async-compression. |
Allows setting the compression quality level for responses. Fixes tower-rs#245
Feature Request
Motivation
Being able to set the compression level will allow one to tweak the settings for optimal speed/compression.
It can be quite a big difference in speed mostly, especially if things are at max.
Proposal
My thoughts are that
with_quality
is exposed fromasync_compression
.https://docs.rs/async-compression/latest/src/async_compression/macros.rs.html#19
The interesting one is the
Level::Precise
so just having access to that should give much of the customizationhttps://docs.rs/async-compression/latest/src/async_compression/lib.rs.html#208
Alternatives
Haven't tried it but i guess one could manually implement their own compression layer,
or do the compression in the request handler.
I believe it would be quite unnecessary to do that workaround when there's already a
CompressionLayer
available.:)
The text was updated successfully, but these errors were encountered: