在Github Api中closurescertificatevalidation

我正在使用这个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 }); 

想closures在Node js中从这个对象进行的所有HTTP请求的证书validation

如何发送,是否有任何具体的标题值需要发送closures?

你可以试试 :

 process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0; 

但这会使所有的请求不安全

所以…我认为rejectUnauthorized:true是你正在寻找的代理选项。

由于node-github使用https-proxy-agent,我想你必须在第666行的构造函数中使用proxyUrl.rejectUnauthorized = true之前设置它。