graphql-request
graphql-request copied to clipboard
Add support for GET requests
Fixes #61
Hmm, the universal-url
package is pretty big. I'm not sure how to proceed. Should I use universal-url-lite
instead which has some caveats? Or should I just add a note to README to let downstream consumers that a URL
polyfill is required?
Hmm given that it's a fairly rare use case that you'd query a GraphQL server via GET + universal-url
seems to add some significant size increase, I'm not sure whether we should add this in order to keep the package small.
Other thoughts?
I actually changed the implementation to use the built-in Node.js url
and querystring
modules since URL
always requires an absolute URL and throws an error when the URL is relative. We are using GET for non-private data to be able to cache the responses at the CDN level (relevant discussion). POST
requests are not cachable.
Of course, using url
and querystring
means that using this library requires bundling with Webpack/Browserify/Rollup. So this solution isn't perfect either.
Please feel free to close this if you don't think it's something you would want to support.
Thanks a lot for elaborating @forabi – you use case makes sense.
I'd like to keep this open a bit longer to hear thoughts of other people before making a decision. Maybe you'd want to publish a fork in the meanwhile?
Maybe you'd want to publish a fork in the meanwhile?
I already did :smile: (@forabi/graphql-request
)
@schickling It just occurred to me that this library already requires bundling since it's import
-ing cross-fetch
.
Is there any progress on this? I really need this feature 😄
Prismic GraphQL API is using GET rather than POST for their requests, so I'm unable to use this library because GET is not supported. Is there any plan to incorporate this based on the latest @forabi's comment?
Any news about 'GET' requests ?