有人做过node https发送post请求?错误提示unknown protocol:openssl\ssl\s23_clnt.c:766:
发布于 8个月前 作者 adam1985 1301 次浏览

D:\node\weishi>node post problem with request: 8820:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:un known protocol:openssl\ssl\s23_clnt.c:766:

代码 var https = require(‘https’); var options = { hostname: 'open.t.qq.com’, port: 80, path: '/api/auth/token’, method: ‘POST’ }; var req = https.request(options, function (response) { var str = '’; response.on('data’, function (data) { str = str + data; }); response.on('end’, function () { console.log(str); }); }); req.on('error’, function (e) { console.log('problem with request: ' + e.message); }); //req.write(“”); req.end();

2 回复

https 默认端口是 443,你的 options 里用的是 80 端口,可能是这个?

@leapon 没错,就是这个问题!

回到顶部