node-restify icon indicating copy to clipboard operation
node-restify copied to clipboard

Update response.send() to check HTTP status code length

Open Adimvicky opened this issue 5 years ago • 1 comments

I updated line 300 which checks that the HTTP status code passed into the Response.send() function is of type "number" to also check that the length of the status code is equal to three since all HTTP status codes are three digits. This allows for the Response.send() function to send ordinary numbers of any length ( other than three ) as response if need be, instead of throwing.

Pre-Submission Checklist

  • [x] Opened an issue discussing these changes before opening the PR
  • [ ] Ran the linter and tests via make prepush
  • [ ] Included comprehensive and convincing tests for changes

Issues

Closes:

  • Issue #
  • Issue #
  • Issue #

Summarize the issues that discussed these changes

Changes

What does this PR do?

Adimvicky avatar Nov 21 '18 15:11 Adimvicky

I don't think this would be a good feature like it is...

  1. It adds computation overhead to each and every request
  2. You can simply use something like https://www.npmjs.com/package/statuses and check it in your own code

kolbma avatar Jun 22 '23 16:06 kolbma