Sending GraphQL Query in Gatling(Java language) using query from file (request body)

Hello, I would like to ask - is it possible to somehow send GraphQL Query using Gatling (take the request body from file)?
I put my body in resources directory in file with .graphql extension, but I got 400 in response ( bad request) and error like:

{"errors":[{"message":"Invalid GraphQL request","extensions":{"details":"failed to deserialize the request body into JSON: expected value at line 1 column 1","code":"INVALID_GRAPHQL_REQUEST"}}]}

I managed to send GraphQL query using .body(StringBody()) in ChainBuilder, but I have somme issues with getting query from file.

Your .graphql file is just the descriptor, so that’s not what you must pass in the body. Instead, you must pass the JSON body your GraphQL client would send in the actual wire request.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.