实现一个 REST API 服务器,当捕获 PUT 请求时,消息体为空
服务器:Windows Server Web SP2 IIS:版本 7.0.6000.16386 节点 v0.8.16 iisnode v0.2.2
测试代码:
var server = http.createServer(function (request, response) {
var data = '';
request.on('data', function (chunk) {
data += chunk;
console.log(data)
});
request.on("end", function(){
response.writeHead(200, { 'Content-Type': 'application/json' });
response.end(data);
});
});