Frisby的Get方法不适用于https [英] Get method of frisby does not work with https

查看:111
本文介绍了Frisby的Get方法不适用于https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是frisby考试的新手.今天,我发现我无法从friby api

I am new to frisby test. today i found I can't access https://ip address from 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,它将要求您进行确认,然后才能继续进行不安全的连接.

This is beacuse the unsafe connection (non-trusted SSL certificate). If you open same URL in a browser, it will ask for confirmation before to continue with the insecure connection.

要在frisby中执行相同的操作,请向.get(...)方法添加第二个参数以指定strictSSL = false,如下所示:

To do the same thing in frisby, add a second param to .get(...) method to specify strictSSL = false as follows:

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();

这篇关于Frisby的Get方法不适用于https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆