-
Notifications
You must be signed in to change notification settings - Fork 30k
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
doc: add simple http clientError example #5248
Conversation
}); | ||
server.on('clientError', (err, socket) => { | ||
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n'); | ||
server.close(); |
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 don't think that server.close()
is relevant here.
Otherwise LGTM |
The clientError event allows proper http 4xx responses to be returned when a parse error occurs, but the documentation did not demonstrate how to use it.
329aa60
to
649c3b0
Compare
@indutny ... removed the |
LGTM |
LGTM, please land ;) |
The clientError event allows proper http 4xx responses to be returned when a parse error occurs, but the documentation did not demonstrate how to use it. PR-URL: #5248 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
btw, I believe this currently only works in master... |
Only master, right. |
The clientError event allows proper http 4xx responses to
be returned when a parse error occurs, but the documentation
did not demonstrate how to use it.
/cc @nodejs/http @indutny