为了账号安全,请及时绑定邮箱和手机立即绑定

返回200,但是评论却没有看见新增,求解

返回200,但是评论却没有看见新增,求解

慕神1332585 2016-03-16 15:52:27
var http = require('http');var querystring = require('querystring');//把对象序列化var postData = querystring.stringify({ 'content':'12345', 'cid':348});var options = { hostname:'www.imooc.com', port:80, path:'/course/docomment', meth:'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=f81665e5-11b0-41eb-9a31-07a5bb5a41e0;imooc_isnew_ct=1457316482;IMCDNS=0;loginstate=1;apsid=gzNTc0NzdjMGM1NGU4N2JkNDE5MWJlNTY0MTkzYjMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjczMzgyMgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxMjU5MDMxMDFAcXEuY29tAAAAAAAAAAAAAAAAAAAAADFiODUxNzgyZjg3YmI4Y2ZiNGY2OGNlYjExNmVlNmZln%2BLcVp%2Fi3FY%3DZj;last_login_username=125903101%40qq.com;bdshare_firstime=1457935399282;PHPSESSID=mmgrt2fjfdr85k7pfigdjha856;jwplayer.qualityLabel=è¶æ¸;jwplayer.mute=false;jwplayer.volume=100;imooc_isnew=2;cvde=56e8abaf0b785-76;Hm_lvt_f0cfcccd7b1393990c78efdeebff3968=1457915837,1457935981,1458001811,1458088818;Hm_lpvt_f0cfcccd7b1393990c78efdeebff3968=1458111895',        'DNT':'1',        'Host':'www.imooc.com',        'Origin':'http://www.imooc.com',        'Referer':'http://www.imooc.com/comment/348',        'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko)         Chrome/48.0.2564.97 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();
查看完整描述

1 回答

?
慕用0418482

TA贡献98条经验 获得超15个赞

返回200代表请求成功,还要看有没有返回值

查看完整回答
反对 回复 2016-08-02
  • 1 回答
  • 0 关注
  • 1419 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信