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

http: return Content-Length header for HEADs #56681

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

qwerzl
Copy link

@qwerzl qwerzl commented Jan 21, 2025

In the current http library, all responses without body will not return the Content-Length header.

Fixes: #56680

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Jan 21, 2025
@qwerzl qwerzl changed the title fix(http): return Content-Length header for HEADs http: return Content-Length header for HEADs Jan 21, 2025
@geeksilva97
Copy link
Contributor

Can you add a test that covers this change?

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.20%. Comparing base (fdad2fa) to head (4183136).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
lib/_http_outgoing.js 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #56681      +/-   ##
==========================================
- Coverage   89.20%   89.20%   -0.01%     
==========================================
  Files         662      662              
  Lines      191899   191899              
  Branches    36940    36935       -5     
==========================================
- Hits       171184   171183       -1     
- Misses      13546    13551       +5     
+ Partials     7169     7165       -4     
Files with missing lines Coverage Δ
lib/_http_outgoing.js 95.15% <50.00%> (-0.08%) ⬇️

... and 39 files with indirect coverage changes

In the current http library, all responses without body will not return
the Content-Length header.

Fixes: nodejs#56680
@qwerzl qwerzl force-pushed the fix/head-content-length branch from 4183136 to 8c4c5fc Compare January 22, 2025 02:28
@qwerzl
Copy link
Author

qwerzl commented Jan 22, 2025

Can you add a test that covers this change?

@geeksilva97 Sure! I've modified the test file for HEADs to make sure that Content-Length is received. Also I've changed the message of the first commit to adhere to the guideline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[http]: Missing Content-Length Header when Responding to HEAD Requests
3 participants