pcyan edited a comment on issue #6266: URL: https://github.com/apache/apisix/issues/6266#issuecomment-1033360012
> In fact, I tested both commands locally and they worked > > config > > ``` > curl http://127.0.0.1:9080/apisix/admin/routes/7 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d ' > { > "methods": ["POST"], > "name":"mockGetUser", > "uri": "/graphql", > "vars": [ > ["graphql_operation", "==", "query"], > ["graphql_name", "==", "getUser"] > ], > "upstream": { > "type": "roundrobin", > "nodes": { > "127.0.0.1:1980": 1 > } > } > }' > ``` > > curl command > > ``` > curl -X POST http://127.0.0.1:9080/graphql -d ' > query getUser { > owner { > name > } > repo { > created > } > }' > ``` > > It could be that you missed '-POST'? A standard GraphQL POST request should use the application/json content type, and include a JSON-encoded body of the following form: ```json { "query": "...", "operationName": "...", "variables": { "myVariable": "someValue", ... } } ``` see official graphql document, https://graphql.org/learn/serving-over-http/#post-request and `--data` will perform request with `POST` method ,see `curl` document -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
