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

headers vs _headers #471

Closed
bdefore opened this issue Oct 21, 2015 · 2 comments
Closed

headers vs _headers #471

bdefore opened this issue Oct 21, 2015 · 2 comments

Comments

@bdefore
Copy link

bdefore commented Oct 21, 2015

app.use((req, res) => {
  res.set('Logged-In', true);
  console.log('headers', res.headers);
  console.log('headers', res._headers);
}

is it expected behavior that res.headers does not show current state? even chaining middleware has the problem.

@dougwilson
Copy link
Contributor

Hi @bdefore , we rely on the Node.js HTTP API and they do not provide any API (that's not private) to access the headers on the response object (https://nodejs.org/api/http.html#http_class_http_serverresponse). I don't think we have res.headers or res._headers in our documentation, unless I'm' mistaken somehow :)

Node.js is currently considering adding an API for this (that's not private) over at nodejs/node#1873 if you want to chime in :)

@bdefore
Copy link
Author

bdefore commented Oct 21, 2015

thanks for the follow up @dougwilson ... it's a bit of a shame but good to hear you know of it.

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

No branches or pull requests

2 participants