我正在使用node.js request.js来访问api.我收到了这个错误
[错误:UNABLE_TO_VERIFY_LEAF_SIGNATURE]
我的所有凭据都是准确有效的,服务器也很好.我跟邮递员提出了同样的要求.
request({
"url": domain+"/api/orders/originator/"+id,
"method": "GET",
"headers":{
"X-API-VERSION": 1,
"X-API-KEY": key
},
}, function(err, response, body){
console.log(err);
console.log(response);
console.log(body);
});
Run Code Online (Sandbox Code Playgroud)
此代码只是在可执行脚本ex中运行.node ./run_file.js那是为什么?它需要在服务器上运行吗?
系统:Windows 7
NodeJS版本:0.10.2
WS模块:ws,最后一个版本
错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
at SecurePair. (tls.js:1283:32)
at SecurePair.EventEmitter.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:896:10)
at CleartextStream.read [as _read] (tls.js:430:15)
at CleartextStream.Readable.read (_stream_readable.js:294:10)
at EncryptedStream.write [as _write] (tls.js:344:25)
at doWrite (_stream_writable.js:211:10)
at writeOrBuffer (_stream_writable.js:201:5)
at EncryptedStream.Writable.write (_stream_writable.js:172:11)
at write (_stream_readable.js:547:24)
服务器:
(function(){
"use strict";
var fs = require('fs');
// you'll probably load configuration from config
var cfg = {
ssl: true,
port: 8080,
ssl_key: 'crt/server1.key',
ssl_cert: 'crt/server1.crt'
};
var httpServ = …Run Code Online (Sandbox Code Playgroud)