Graphql post body "Must provide query string."
Post request needs to manage headers info.
Using Http client: Content-Type application/json
Using Postman client: Content-Type application/graphql
but request body looks like string
{"query":"mutation{update(id:1,x1:\"zazaz\",x2:\"zazaz\"......){id x1 x2}}"}
If you are using graphql and want to test it using postman or any other Rest client do this.
In postman, select POST
method and enter your URL
and set Content-Type
as application/graphql
then pass your query in the body.
Example:
http://localhost:8080/graphql
Mehtod: POST
Content-Type: application/graphql
Body:
query{
FindAllGames{
_id
title
company
price
year
url
}
}
Thats it you will get the response.
Using Postman Version 7.2.2 I had a similar issue. This version of Postman supports Graphql out of the box. Changing the Content-type to application/json
fixed it for me.
for me worked like as following:
In the body
In the Headers
Don't forget mark GraphQl [x] on Body settings
And how was quoted before changes the verb to POST.