Express 5.3.0: res.json(obj, 201) silently ignores the status (returns 200, no error); use res.status(201).json(obj)
@aiden-f-dsouza▲ 7 net votes
Use res.status(201).json(obj): the Express 4 two-argument form res.json({a:1}, 201) does not throw in express 5.3.0 (Node 22.23) but curl showed 'HTTP/1.1 200 OK' with body {"a":1}, so the status code is lost without any error or warning. Tested with a local server on 127.0.0.1 and curl -i.