在 Github Api 中关闭证书验证
Turn off cerficate validation in 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 中从此 object 进行的所有 HTTP 请求。
如何发送,是否需要发送特定的 header 值才能关闭?
你可以试试:
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
但这会使 ALL 请求 不安全
所以...我认为 rejectUnauthorized:true
是您正在寻找的代理选项。
由于 node-github 使用 https-proxy-agent,我认为您必须在构造函数中使用它之前设置 proxyUrl.rejectUnauthorized = true
at line 666
我正在使用这个 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 中从此 object 进行的所有 HTTP 请求。
如何发送,是否需要发送特定的 header 值才能关闭?
你可以试试:
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
但这会使 ALL 请求 不安全
所以...我认为 rejectUnauthorized:true
是您正在寻找的代理选项。
由于 node-github 使用 https-proxy-agent,我认为您必须在构造函数中使用它之前设置 proxyUrl.rejectUnauthorized = true
at line 666