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

Check res.headersSent before calling res.setHeader() in bail() #2

Merged

Conversation

robert-chiniquy
Copy link
Contributor

I noticed sometimes bail() would be called after headers had already been written on the response. In this case, instead of writing the error back on the response, it throws and kills the server process.

This fix just doesn't set text/plain if headers have already been written, so the error is written to the request and the server can serve subsequent requests.

@hughsk
Copy link
Owner

hughsk commented Oct 19, 2014

Awesome, thanks @robert-chiniquy! :D

hughsk added a commit that referenced this pull request Oct 19, 2014
…in-bail

Check res.headersSent before calling res.setHeader() in bail()
@hughsk hughsk merged commit b8ddb60 into hughsk:master Oct 19, 2014
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.

2 participants