报了错TypeError: Trailer name must be a valid HTTP Token ["Origin:http"],哪里出错了 求教
运行之后报了个TypeError的错误
_http_outgoing.js:347 throw new TypeError( ^ TypeError: Trailer name must be a valid HTTP Token ["Origin:http"] at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:347:13) at new ClientRequest (_http_client.js:79:14) at Object.exports.request (http.js:31:10) at Object.<anonymous> (/Users/Eva/dev/project/nodejs/imooc/http/comment.js:31:16) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10) at startup (node.js:139:18)
//代码如下 var http = require('http'); var querystring = require('querystring'); var postData = querystring.stringify({ "content":"学习,学习", "mid":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,en;q=0.6', 'Connection':'keep-alive', 'Content-Length':postData.length, 'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie':'imooc_uuid=c24f709e-23fc-4658-ab64-952b3fcc4f3d; imooc_isnew_ct=1474594580; loginstate=1; apsid=Y5ZGUwM2EzYzhjNzI4ZGQ5NTliY2FmNzJiMjM3ODgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMTM2NjE3MQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxMjYyMzQ3NTkzQHFxLmNvbQAAAAAAAAAAAAAAAAAAADk0YzJmMDhhYzlmNmI2MGE2YWZiOWQwNjI3ZTY0YTQz0YzkV9GM5Fc%3DNj; last_login_username=1262347593%40qq.com; PHPSESSID=o3pb9qn62hp87jrhcesanvi3p1; jwplayer.qualityLabel=è¶æ¸; jwplayer.volume=78; IMCDNS=0; Hm_lvt_f0cfcccd7b1393990c78efdeebff3968=1474594582,1474883477; Hm_lpvt_f0cfcccd7b1393990c78efdeebff3968=1474964809; imooc_isnew=2; cvde=57e8ef93cfa6a-41', 'Host':'www.imooc.com', 'Origin:http':'//www.imooc.com', 'Referer:http':'//www.imooc.com/video/8837', 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 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();