Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestPromiseResponse json body #80

Closed
ludeknovy opened this issue May 23, 2020 · 4 comments
Closed

RequestPromiseResponse json body #80

ludeknovy opened this issue May 23, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@ludeknovy
Copy link
Contributor

Describe the bug
RequestPromiseResponse throws TypeError: res.body.replace is not a function. This happens when request is made with json: true, thus the retuned value is not json string but object.

To Reproduce

  • Send request with json: true, i.e: { method: 'GET', json: true, url: 'your-url', resolveWithFullResponse: true, simple: false}
    * assert that response with expect(response).toSatisfyApiSpec()

Expected behavior
Handle json without throwing an error.

The problem is on line 7 in RequestPromiseResponse:
this.body = res.body.replace(/"/g, '');

@ludeknovy ludeknovy added the bug Something isn't working label May 23, 2020
@rwalle61
Copy link
Collaborator

thanks for this! Should be a straightforward fix. Would you like to submit a PR?

Otherwise I will see when I have time to test and fix this

@ludeknovy
Copy link
Contributor Author

@rwalle61 I might submit a PR.

@rwalle61
Copy link
Collaborator

thanks!

@rwalle61
Copy link
Collaborator

Released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants