forwardemail / forwardemail/supertest

GraphQL error on return on not query present

Open
#575 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.4k
Forks
782
PR merge metrics
No merged PRs in 30d

Description

When i make a POST to the graphQL url instance, i got :

` SyntaxError: Unexpected token { in JSON at position 65
at JSON.parse ()`

trying to parse the response.

this is the piece :

`console.log node_modules/superagent/lib/node/parsers/json.js:12
{"errors":[{"message":"Must provide query string.","fields":[]}]}{"errors":[{"message":"Must provide query string.","fields":[]}]}`

This is my request without query:

`it('GraphQL must run', async (done) => {
return request(server)
.post('/api?')
.set('Content-Type', 'application/graphql')
.set('Accept', 'application/json')
.expect(400)
})`

To evade this i make a `JSON.stringify` to the res.text

or there is a best way ?

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.