关闭Github Api中的cerficate验证

时间:2017-08-19 22:35:36

标签: node.js github github-api

我正在使用这个github api

var github = new GitHubApi({
    // optional
    debug: true,
    protocol: "http",
    host: "github.my-GHE-enabled-company.com", // should be api.github.com for GitHub
    pathPrefix: "/api/v3", // for some GHEs; none for GitHub
    headers: {
        "user-agent": "My-Cool-GitHub-App" // GitHub is happy with a unique user agent
    },
    Promise: require('bluebird'),
    followRedirects: false, // default: true; there's currently an issue with non-get redirects, so allow ability to disable follow-redirects
    timeout: 5000
});

想要关闭来自Node js中此对象的所有HTTP请求的证书验证

如何发送,是否需要发送任何特定的标头值才能关闭?

1 个答案:

答案 0 :(得分:0)

您可以尝试:

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;

但这会使所有请求不安全

所以......我认为rejectUnauthorized:true是您正在寻找的代理商选项。

由于node-github使用https-proxy-agent,我认为你必须在构造函数at line 666

中使用之前设置proxyUrl.rejectUnauthorized = true
相关问题