I have enabled the batch query processing functionality in Graphene-Django by adding batch=True
to the .as_view(...)
method as,
urlpatterns = [
# other URL patterns,
path('graphql/', CustomGraphQLView.as_view(schema=schema, batch=True), name='graphql')
]
After that, I sent the request (see below screenshot) with a query to the server using Postman client, but got an error
GraphQL Query
{
musicians {
id
name
}
}
Error Response
{ "errors": [ { "message": "Batch requests should receive a list, but received {'query': 'bla bla'}" } ] }
Postman Screenshot
Question
- What is the proper way to send the GraphQL batch requests to Graphene-Django?
- How can I send GraphQL batch requests to Graphene-Django using Postman client?
The Graphene-Django expects the queries as a list of dicts (or JSON Array of JSON Objects).
So you need to build a payload as,
Make sure that, the request should be sent as raw JSON from the POSTMAN client (or any non-GraphQL client)
Result Screenshot