【发布时间】:2019-06-04 04:14:04
【问题描述】:
当 http 请求如下所示时,我可以触摸我的代码:
POST /init HTTP/1.1
Host: 127.0.0.1
Connection: keep-alive
Content-Length: 1343
http 请求如下所示:
POST init HTTP/1.1 // what different is : the path without a '/'
Host: 127.0.0.1
Connection: keep-alive
Content-Length: 1343
我的 node.js 代码是:
http.createServer(function (req, res) {
console.log('sth')
}).listen(3000);
很遗憾,我无法更改发出 init 请求的代码。
【问题讨论】:
-
有趣...我想知道这是否被认为是有效的 HTTP 请求?
-
你是对的.. 但我的客户不想修复它,所以我想适应这种情况。