-
Notifications
You must be signed in to change notification settings - Fork 982
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
Setting the status code with res.status has no effect #1429
Labels
Comments
svozza
added a commit
to svozza/node-restify
that referenced
this issue
Aug 3, 2017
Encountering this issue as well |
This was me 😞 |
svozza
added a commit
to svozza/node-restify
that referenced
this issue
Aug 8, 2017
3 tasks
This was referenced Aug 9, 2017
sean3z
pushed a commit
that referenced
this issue
Aug 14, 2017
This was just merged in - think we are good to cut a release for this! |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Restify Version
5.0.1
Node.js Version
Node 8
Expected behaviour
When using
res.status
in a route, I expect the status code set there to be the one returned whenhitting the route.
Actual behaviour
The route always returns a 200.
Repro case
Here's the test I have in my branch:
Cause
The offending code is here:
https://github.com/restify/node-restify/blob/5.x/lib/response.js#L307
https://github.com/restify/node-restify/blob/5.x/lib/response.js#L311
On line 307 if
code
is undefined it gets set to 200 and then on line 311 that overwritesself.statusCode
even if it has already been set.Are you willing and able to fix this?
Yes. In fact, I've already fixed it on my fork.
The text was updated successfully, but these errors were encountered: