res.send(number) to not override statusCode if already defined by res.status(code)

The problem:

res.status(200).send(1000)

returns

invalid status code: 1000

This prevents sending a number as response without converting to string before. If statusCode was set by res.status(code), it should handle the number without override the statusCode.

Author: Fantashit

1 thought on “res.send(number) to not override statusCode if already defined by res.status(code)

  1. Yea, but that change would be a breaking change. I would suggest making this change in 5.0, but in 5.0 res.send(number) no longer changes the status code at all to that number, so effectively this issue is resolved in 5.0. This is available in 5.0.0-alpha.1 and higher 🎉

Comments are closed.