通过 frisbyJS 调用服务时无法获得任何响应

Can't get any response back while calling service through frisbyJS

我使用的代码是:

var frisby = require('frisby');
frisby.create('Get paf data')
.get('https://services.....')
.expectStatus(200)
.expectHeaderContains('content-type', 'application/json')
.toss();

我在使用

从 CLI 运行 宁它时得到的错误
jasmine-node EndpointTest_spec.js

我得到的错误是:

错误:预期 500 等于 200

错误:Header 'content-type' 不存在于 HTTP 响应中

那么我是否需要先加载我的网站并通过我的应用程序调用服务,然后 运行 frisby?

但是这样就违背了在没有 运行 的情况下快速检查应用程序中使用的所有端点的目的。

您正在使用 https:// 调用请求,这可能是安全服务器,因此请使用

{ strictSSL: false} in your get method .get('https://services.....',{ strictSSL: false}). It will solve your problem.

var frisby = require('frisby');
frisby.create('Get paf data')
  .get('https://services.....',{ strictSSL: false})
  .expectStatus(200)
  .expectHeaderContains('content-type', 'application/json')
.toss();