angularjsfrisby.js

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


The code I am using is:

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

The error I get while running it from CLI using

jasmine-node EndpointTest_spec.js

The error I get is:

Error: Expected 500 to equal 200

Error: Header 'content-type' not present in HTTP response

So do I need to first load my website and call services through my application and then run frisby ?

But then it defeats the purpose of just making a quick check for all the endpoints used in application without running it.


Solution

  • You are calling request with https:// which may be secure server so use

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