graphql-over-http icon indicating copy to clipboard operation
graphql-over-http copied to clipboard

Clarify the use of HTTP GET and POST request

Open TomokiMiyauci opened this issue 1 year ago • 2 comments

from GraphQL over HTTP Spec

A server MUST accept POST requests, and MAY accept other HTTP methods, such as GET.

For semantics and performance (caching, etc.), it seems to me that it is recommended to use GET for the query operation.

If the options are not equivalent, it is necessary to clarify which is more appropriate.

TomokiMiyauci avatar Jul 19 '22 14:07 TomokiMiyauci

One possible concern I could see with GET requests is the limited length of a URL. Some web server defaults:

When fragments, unstripped comments, lots of variables and multiple levels of nesting are involved, payloads can get quite large. A quick look at our application logs showed a few queries above 1000 characters.

spawnia avatar Jul 19 '22 17:07 spawnia

@spawnia

RFC 7230

It is recommended that all HTTP senders and recipients support, at a minimum, It is recommended that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.

That is certainly true.

What do you think about caching of query operation? Caching using the POST method seems to be possible, but I am not familiar with it.

Some implementations have complex mechanisms for handling cache on the client side, but I doubt it is really necessary.

It would be helpful to have a description of caching in the Spec.

TomokiMiyauci avatar Jul 20 '22 15:07 TomokiMiyauci