Skip to content

Unhandled promise rejection: TypeError: response.textConverted is not a function while using Jasmine with Frisby #588

@mcoulont

Description

@mcoulont

Hello

My question is here but I kind of copy it below for the sake of readability.

I use Jasmine (in Angular) to access the server with the following test:

it("webmaster's email address", function(done) {
  frisby.setup({
    request: {
      headers: {
        'Authorization': Buffer.from(
          component.getAuthService().toString()
        ),
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
      }
    }
  }, true)
  .get('http://localhost:80/api/getWebmasterEmail')
  .then(function(response: any) {
    expect(response.status).toBe(200)
  })
  .done(done);
})

But Jasmine returns the following error:

Unhandled promise rejection: TypeError: response.textConverted is not a function
TypeError: response.textConverted is not a function
    at http://localhost:9876/_karma_webpack_/webpack:/node_modules/frisby/src/frisby/spec.js:145:25
...

I've run npm install encoding

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions