Skip to content

Conversation

@Xuanwo
Copy link
Contributor

@Xuanwo Xuanwo commented May 7, 2025

This PR adds the per request compression config like gzip, zstd and so on.


This PR adds a number of new request-level APIs, all of which follow the same style as the existing ones. We will return None directly if the corresponding feature is not enabled, allowing users to call req.gzip_mut.map(|v| *v = false) to achieve the same effect as no_gzip.

I'm open to alternative API designs like req.no_gzip().

@Xuanwo Xuanwo mentioned this pull request May 7, 2025

/// Get the `gzip` option on this request.
#[inline]
pub fn gzip(&self) -> Option<&bool> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my gut feeling: for now, there's less need to provide all these getters on the Request type. I would just put the equivalent gzip(bool) functions on the RequestBuilder.

(Hm, with all these possible options, it occurs to me that a user might just want to say no_(de)compression() on either builder, to indicate never use any of the decoders...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just put the equivalent gzip(bool) functions on the RequestBuilder.

I'm fine with this change. Let me add those functions to RequestBuilder first and gather some feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting no_gzip / gzip for Request

2 participants