相关疑难解决方法(0)

错误:无法验证nodejs中的第一个证书

我正在尝试使用url从jira服务器下载文件,但是我收到了一个错误.如何在代码中包含证书以验证 错误:

Error: unable to verify the first certificate in nodejs

at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:929:36)

  at TLSSocket.emit (events.js:104:17)

at TLSSocket._finishInit (_tls_wrap.js:460:8)
Run Code Online (Sandbox Code Playgroud)

我的Nodejs代码:

var https = require("https");
var fs = require('fs');
var options = {
    host: 'jira.example.com',
    path: '/secure/attachment/206906/update.xlsx'
};

https.get(options, function (http_res) {

    var data = "";


    http_res.on("data", function (chunk) {

        data += chunk;
    });


    http_res.on("end", function () {

        var file = fs.createWriteStream("file.xlsx");
        data.pipe(file);

    });
});
Run Code Online (Sandbox Code Playgroud)

jira ssl-certificate node.js

105
推荐指数
9
解决办法
18万
查看次数

标签 统计

jira ×1

node.js ×1

ssl-certificate ×1