Node.js HTTP server won't send response body with status code: 204
Because the http status code 204 means ‘no content’, even if you send body text, it won’t be sent with the request:
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(204);
response.end('Body text');
}).listen(8000);
curl http://localhost:8000
[nothing]
But if the status is 200:
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200);
response.end('Body text');
}).listen(8000);
it’s as expected:
curl http://localhost:8000
"Body text"
This is not a complaint but an observation that Node.js is opinionated about status codes and their meaning (and I didn’t expect it to be).