-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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
Throw on bad argument to res.status() #2795
Comments
Hm, weird. I don't think Express has such a thing as |
Ah, I think perhaps you just made a typo in the description and are probably talking about var http = require('http')
var server = http.createServer(function (req, res) {
res.statusCode = undefined
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ prop: 'val' }))
})
server.listen(3000) We can certainly start restricting the values to A PR is welcome to add the argument check! |
@dougwilson oops. you are right. It is res.status(). Thanks! |
I created a pull request to solve this where arguments of null or undefined to res.status throw an error. Sorry for all of the referenced messages this is my first time creating a pull request. I deleted my first fork and remade it but apparently the references are still there, I didn't know that would happen. |
@dougwilson Hey, I want to take this up, I need a little guidance on where the error is being emitted from and how I can fix it. Thanks. |
Hi @buoyantair the pull request has already been made by another user, unfortunately. |
Hi @dougwilson , if the issue is solved. Can you please close it? |
The PR is pending open questions and has not yet been merged into any release line, so it's not actually closed. The open status of the issue is accurate. If you believe otherwise please outline why you think the issue should be closed and I can close it. |
@dougwilson Yeah, I understand you. I meant if there is already pull request that was accepted so, I thought this PR should be closed then. But I'm new here so not sure exactly how you guys manage the releases. Thank you for replying back. I'll keep looking for existing issues that I can help with. Let me know if there is something I have to know before starting on any issue. |
Hi @KhaledSamir sorry if there is any confusion; this is not a PR, it is an issue. The PR that was made to resolve this issue has not yet been accepted, hence why the issue is still open. I hope that makes sense. |
@dougwilson Yup gotcha!. Thank you, man! |
This error message prompted me to inspect the variable I passed in res.json instead of res.statusCode
express@4.0.0
The text was updated successfully, but these errors were encountered: