forwardemail / forwardemail/superagent

Error JSON response aren't being parsed

Open
#1,008 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I noticed a JSON response with status `200` is parsed successfully by superagent (i.e. `response.body` contains the parsed JSON contents), but a JSON response with status `400` does not return a "body" property, even though the Content Type is "application/json". Any setting I'm missing to automatically parse error responses if the error content type is "application/json"?

My current workaround is to use:

``` js
var parsedError = JSON.parse(e.response.text);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.