我要爆炸了 状态值200 但是没有结果 求解
var http=require('http');
var querystring=require('querystring');
//formdata
var postData=querystring.stringify({
'content':'测试测试,代码成功',
'cid':8837
})
var options={
hostname:'www.imooc.com',
port:80,
path:'/course/docomment',
method:'POST',
headers:{
'Accept':'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-CN,zh;q=0.8',
'Connection':'keep-alive',
'Content-Length':postData.length,
'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
'Cookie':'imooc_uuid=f7cd2825-8777-421f-adca-129513b1bc87;imooc_isnew_ct=1500886280;loginstate=1;apsid=UyYmIxYjIyYWM2OGZhZmYwOGRkYTcwMmQxNjNhMzQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMzI4MDUzNQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxODgwMDE4MTYxNUAxNjMuY29tAAAAAAAAAAAAAAAAADgxMzEyNmY2MzU4ZmQwMzRkZGU1MmJkYTRkMTlkNDViDLV1WQy1dVk%3DMm;last_login_username=18800181615%40163.com;PHPSESSID=t0191hsbskp939tu9ve0dm73t7;IMCDNS=0;Hm_lvt_f0cfcccd7b1393990c78efdeebff3968=1500886250,1502262366,1503278962;Hm_lpvt_f0cfcccd7b1393990c78efdeebff3968=1503307488;imooc_isnew=2;cvde=599a378946781-144',
'Host':'www.imooc.com',
'Origin':'http://www.imooc.com',
'Referer':'http://www.imooc.com/video/8837',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36',
'X-Requested-With':'XMLHttpRequest'
}
}
var req=http.request(options,function(res){
console.log('Status: '+res.statusCode);
console.log('headers:'+JSON.stringify(res.headers));
res.on('data',function(chunk){
console.log(Buffer.isBuffer(chunk));
console.log(typeof chunk)
})
res.on('end',function(){
console.log('评论完毕!');
})
})
req.on('error',function(e){
console.log('Error:'+e.message)
})
req.write(postData);
req.end();