-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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.OutgoingMessage headers API #1873
Comments
You may want to have a look at #772, which was originall a I didn't go through with it however, and doing it right requires re-writing far more bits of http than I was able to do. |
@Fishrock123 What's the reason for making the already sent headers ungettable? |
@ChALkeR I'm not sure, is that the current impl? I would say it maybe shouldn't? Honestly though, no clue. |
Ah, I misread #772, sorry. Edit: No, I didn't.
|
Ok, so there are no objections to adding such API methods at this moment, as I understand it. |
@ChALkeR in general, I think it would be interesting to explore that option. I think it'd be better if you suggested a concrete API we can discuss. |
Isn't that covered by Re: holding on to sent headers – I believe we avoid it on the grounds of not holding onto "informational" data that the user could grab earlier. re: the reasoning: I'm not sure a list of |
@chrisdickinson the reasoning behind putting this behind an official API is that It might be possible to change I think the point of @ChALkeR is that this is functionality people need and expect to have on |
@chrisdickinson Thanks. Documenting I understand that |
any node contributors have an opinion on an API? i don't mind submitting a PR if there's somewhat of a consensus |
/cc @nodejs/ctc |
Headers API will be a bit tricky, and probably require somewhat of a re-write of headers handling.
|
So, what you're really dealing with is: Current, Sent, and Total ("all") (including on-write) headers. The API probably needs to cover that. :/ |
@ofrobots This is (one of?) the issue(s) for headers handlng refactoring. |
@mscdex the only remaining usecase here is «Check if headers were already sent (like |
Though there is a slight difference in the meaning, I wonder if the existing |
@dougwilson Hm. It probably doesn't make sense to include two of those. I should check then why |
This should stay open, yes? |
@Trott, yes, there are some things that I should check on this one before closing. Thanks for reminding me, though! :-) |
@ChALkeR did you ever get around to this? Is the plan to consolidate |
Should this remain open? |
Closing due to lack of follow up |
Atm,
http.OutgoingMessage
has the following headers-related methods:.setHeader(name, value)
,.getHeader(name, value)
,.removeHeader(name)
.There probably should be methods to:
._headerSent
).Clear all headers (if they were not already sent).— Doable withremoveHeader
andgetHeaderNames
/getHeaders
since http: add new functions to OutgoingMessage #10805.List all headers that were set, with values.— Landed in http: add new functions to OutgoingMessage #10805, thanks, @mscdex!All methods that modify headers should error if the headers were already sent.
Reasoning: https://gist.github.com/ChALkeR/26573ff704f987fd5304
The text was updated successfully, but these errors were encountered: