使用节点的HTTP库,我可以轻松设置我想要的选项
options =
port: 443
path: "/"
method: 'GET'
rejectUnauthorized: false
https.get options, (res) ->
...
如何使用node-scoped-http-client执行相同的操作?
# Passing options doesn't seem to work (defined as above)
cli = msg.http(stats_url, options)
# Injecting it doesn't pass it on either
cli.options['rejectUnauthorized'] = false
我仍然收到此错误:ERROR Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
我在这里错过了什么吗?我对node和coffeescript很新。
答案 0 :(得分:2)
简答:
你做不到。目前,scoped-http-client仅passes on certain options到http
或https
:
req = (if @options.protocol == 'https:' then https else http).request(
port: port
host: @options.hostname
method: method
path: @fullPath()
headers: headers
agent: @options.agent or false
)
长答案:
将其添加到您自己的分叉,发送拉取请求。便宜的方法是将其直接添加到上述请求调用中。处理它的更好方法是实际使用在创建客户端时传入的options对象。
答案 1 :(得分:0)
rejectUnauthorized应该是代理的属性。尝试这样的事情......
options.agent = new https.Agent(options);