Jest/Frisby - FetchError: invalid json response body; how to log the server response

624 Views Asked by At

I probably have an error on my server, because I get this from frisby:

FetchError: invalid json response body at ...

The problem is that I'm not able to see the server response, so I cannot understand what's going wrong.

How can I log the server response using Frisby? I tried to log the response in the then function, without success:

frisby.use(spec => spec.setup({ request: { headers: { 'Token': token1 } } }))
    .post(BASE_URL + 'purchase', purchase)
    .expect('status', 409)  
    .then(res => {
      console.log(res);
    })
    .done(done);

Thanks

0

There are 0 best solutions below