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

Stop sending Content-Length header for verbs which don't have bodies. #1388

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

dcr-stripe
Copy link
Contributor

@dcr-stripe dcr-stripe commented Mar 30, 2022

r? @pakrym-stripe

Summary

Stops sending a Content-Length header for requests which:

  1. Use a verb which doesn't anticipate a body (eg. GET, DELETE) and
  2. Actually has no body.

For requests that don't anticipate a body but end up having one, we'll continue setting the header and emit a warning so that we can track and fix these cases as they are not following proper semantics.

POST, PUT and PATCH request are unchanged.

Motivation

Fixes #1360

`https://${options.host}`,
// No Content-Length should be present for GET requests.
{
badheaders: ['Content-Length'],
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL 👍

Copy link
Contributor

@pakrym-stripe pakrym-stripe left a comment

Choose a reason for hiding this comment

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

Beautiful!

@dcr-stripe
Copy link
Contributor Author

r? @yejia-stripe for calibration

Thanks!

Copy link
Contributor

@yejia-stripe yejia-stripe left a comment

Choose a reason for hiding this comment

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

Lgtm! Thanks for the detailed comments

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.

Deletion commands do not work via fetch
3 participants