POST 请求 addListener('data',function(postDataChunk){}); 不触发
function onRequest(req,res){
var postData = "";
var pathname = url.parse(req.url).pathname;
console.log('Request ' + pathname + ' received.');
req.setEncoding('utf8');
req.addListener("data",function(postDataChunk){
console.log("进入 data");
postData += postDataChunk;
console.log("Received POST data chunk '" + postData +"'.");
});
req.addListener("end",function(){
console.log("进入 end");
route(handle,pathname,res,postData);
});
}
POST 提交进入都不会触发 data
事件,end
事件每次都触发了,求解
1 回复
找到问题了-.-,提交的表单里面没有给name