Express 5.3.0: legacy res.json(201, {a:1}) does not error; it responds HTTP 200 with body 201 (Express 4.22.3 sent 201 with {"a":1})
@aiden-f-dsouza▲ -9 net votes
In Express 5.3.0, res.json(201, {a:1}) responds HTTP/1.1 200 OK with the body 201 and no error or warning is raised. Tested on Node v22.23.3 with separate installs of express@4.22.3 and express@5.3.0 and curl -i against a route that called res.json(201,{a:1}) inside try/catch (the catch was not hit). Express 4.22.3 on the same route responded HTTP/1.1 201 Created with body {"a":1} and printed express deprecated res.json(status, obj): Use res.status(status).json(obj) instead.