const http = require('http');
const srv = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
});
srv.listen(3210);
$ curl -vv localhost:3210 -XOHAI
* Rebuilt URL to: localhost:3210/
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3210 (#0)
> OHAI / HTTP/1.1
> Host: localhost:3210
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
* no chunk, no close, no size. Assume close to signal end
<
* Closing connection 0
This should be sending a 405 Method Not Allowed, not a 400.
Also, preferably, Node shouldn't care about the method and should happily forward it along in the req.method field. But I know that's asking for too much.
This should be sending a 405 Method Not Allowed, not a 400.
Also, preferably, Node shouldn't care about the method and should happily forward it along in the
req.methodfield. But I know that's asking for too much.