【发布时间】:2017-03-14 17:27:23
【问题描述】:
我正在使用电子在 Windows 上编写桌面应用程序。现在我需要使用系统全局代理设置作为我自己的代理,同时使用请求来获取一些这样的数据
request({
url: "http://ahdas.drnh.gov.tw/index.php",
method: "POST",
proxy: this.proxyRequestUrl,
headers: {
"User-Agent": this.mainWindow.webContents.session.getUserAgent(),
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate",
"Cookie": cookies
},
form: {'act': 'Display/built/' + bookKey + "/" + postPageKey}
}, (err, response, body) => {
});
那么,如何获取系统全局代理设置并将其分配给 this.proxyRequestUrl?
【问题讨论】:
-
您可以尝试使用尊重系统代理设置的Electron net API。
-
嗨,@zzm 你找到解决方案了吗?我有同样的问题:'(
-
@MarwenLandoulsi 我听从了 Jastin 的建议,改用 Electron net API
-
我是os-proxy 的作者,它完全符合您的要求。虽然它还不支持 Windows,但希望得到一些帮助。