router icon indicating copy to clipboard operation
router copied to clipboard

Sending graphql request with empty string as operationName produce invalid response

Open IvanGoncharov opened this issue 1 year ago • 0 comments

Describe the bug Issue was reported by @bonnici in Slack: https://apollograph.slack.com/archives/C02UX05LF4K/p1710991184963719 Here is example of requests producing invalid responses:

{ 
  "operationName": "", 
   "query": "query ExampleQuery { me { id } }"
}

Router responses with:

{"data":null}

To Reproduce Steps to reproduce the behavior:

  1. Run following using starstuff:
    curl -H 'Content-Type: application/json' http://127.0.0.1:4000/ -d '{ "operationName": "", "query": "query { me { id } }" }'
    
  2. See {"data":null} as result

Expected behavior It should be a response containing the error and without data. image https://spec.graphql.org/October2021/#GetOperation()

IvanGoncharov avatar Mar 22 '24 15:03 IvanGoncharov