-
Notifications
You must be signed in to change notification settings - Fork 135
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(http): Set content-length only if body is present #638
Conversation
🦋 Changeset detectedLatest commit: 0d304d2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Coverage Report
File Coverage
|
commit: |
body, | ||
remoteAddress, | ||
}: { | ||
constructor(request: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to name the parameter because of a formatting issue.
// Set the content length when there is a body.
// See https://httpwg.org/specs/rfc9110.html#field.content-length
if (body) {
headers["content-length"] ??= String(Buffer.byteLength(body));
}
When saving the file with the previous structure the line if (body) {
would be deleted otherwise 🤨
This would not happen if the comments are moved after the if.
Weird bug but still happens after ESLint and Biome extensions are de-activated in VSCode.
🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, very weird bug indeed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably worth to add a comment explaining this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well... amending the PR to revert the change worked.
To prove I'm not completely 🤪, here is a video when I start from the original file:
Screen.Recording.2024-11-21.at.14.43.09.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prove I'm not completely 🤪, here is a video when I start from the original file:
does it happen if you use /* ... */
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, tried that as well as a few different (potential) workarounds and it results in the same weird bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a little comment, otherwise LGTM Thanks
body, | ||
remoteAddress, | ||
}: { | ||
constructor(request: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably worth to add a comment explaining this
No description provided.