tower-rs/tower-http

Support for larger sizes in `compression::predicate::SizeAbove`

Opened this issue · 0 comments

  • I have looked for existing issues (including closed) about this

Feature Request

Currently, SizeAbove has a u16 inside of it to limit the size where compression is active.
It would be handy if a larger type (like u64) was used instead.

/// [`Predicate`] that will only allow compression of responses above a certain size.
#[derive(Clone, Copy, Debug)]
pub struct SizeAbove(u16);

Motivation

Since the size is in bytes 2^16 bytes is still quite small (64KiB), when the internet connection is fast enough it does not really make sense to compress payloads that small. So if you don't want to compress payloads that small you currently just have to reimplement the same thing, which is not ideal.

Proposal

Increase the type size from u16 to u64. There are no obvious drawbacks apparent for me.
If you would like to make this change I can implement it if you want.