我是飞盘测试的新手。今天我发现我无法访问https://ip来自 friby api 的地址
例如:
frisby.create('my test').get("https://199.59.148.20")
output: connect error
frisby.create('my test').get("https://api.twitter.com")
this one works
请指教!
最佳答案
这是因为连接不安全(不受信任的 SSL 证书)。如果您在浏览器中打开相同的 URL,它会在继续不安全的连接之前要求确认。
要在 frisby
中做同样的事情,请将第二个参数添加到 .get(...)
方法以指定 strictSSL = false
如下:
var frisby = require('frisby');
frisby.create('Get a https resource')
.get('https://199.59.148.20', { strictSSL: false })
.expectStatus(200) // For this case/IP-address this fails as it returns a 404
.inspectBody()
.toss();
关于javascript - frisby 的获取方法不适用于 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32219794/