Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: add simple http clientError example
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>
- Loading branch information
9b6440a
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.
This doesn't work unfortunately. Making this request
curl http://127.0.0.1:8000 -H "content-length: a"
causes server to fail:
9b6440a
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.
@bsnote ... which node.js version?
/cc @indutny
9b6440a
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.
testing using master it works... I believe the fix for this is only available in master currently.
9b6440a
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've been testing using node.js 5.6.0. Is there any other way to return 4xx response using node.js 5.x, when a parse error occurs?
9b6440a
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.
@bsnote ... unfortunately no. The changes with
'clientError'
are semver-major and have only landed inmaster
. It's unlikely that they would be backported to v5 or earlier. /cc @indutny