Skip to content
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

fix(client): send content-length even with no body #3630

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

seanmonstar
Copy link
Member

Most request methods define a payload. If hyper detects that no body has been included, it will now include a content-length: 0 header automatically.

It will not do this for methods that don't have defined payloads (GET, HEAD, and CONNECT).

Most request methods define a payload. If hyper detects that no body has
been included, it will now include a `content-length: 0` header
automatically.

It will not do this for methods that don't have defined payloads (GET,
HEAD, and CONNECT).
@seanmonstar seanmonstar force-pushed the client-http1-auto-content-length branch from 5d3993d to 4be4be9 Compare April 14, 2024 12:47
@seanmonstar seanmonstar merged commit 172fdfa into master Apr 15, 2024
21 checks passed
@seanmonstar seanmonstar deleted the client-http1-auto-content-length branch April 15, 2024 11:26
@@ -1468,6 +1474,11 @@ impl Client {
}
}

#[cfg(feature = "client")]
fn is_method_assumed_empty(method: &Method) -> bool {
matches!(method, &Method::GET | &Method::HEAD | &Method::CONNECT)

Choose a reason for hiding this comment

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

I'd think OPTIONS and DELETE should be included here? Probably also TRACE.

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.

3 participants