Broken off from #391
apollo-link has a useGETForQueries option.
One of the default HttpConfig.options fields specifies method, but it doesn't influence behavior. I'd say this is a low priority though.
As @Codebear98 says:
The benefit of having Get method is performance gain from supporting Cloudflare or other CDN.
To use Get request, you also need to implementAuto persisted queries(APQ) due to the uri length limitation of cloudflareit's covered in ApolloSDK doc, currently web, apollo-android and apollo-ios are supporting APQ+get method.
It's essential if
1. your app is production and have large user base 2. your user will access to the app at the same time suddenly (eg, responds to push notification)Otherwise your server may experience temporary downtime due to high demand of request without CDN.
https://www.apollographql.com/docs/apollo-server/features/apq/
If anyone has an app in production with these kinds of load-based demands, they can start contributing themselves IMO.
I can only dream my app gets to the point where this is a concern 馃槄
Yes we do have production apps were encountering that issues but they are native apps.
We wanna implement another app with flutter, it鈥檒l be the issue we need to go through again.
I have an idea on this feature, I am thinking it is not as hard as it seems at first (Could be wrong though). I will try it out and see if it works.
@micimize I have a rough implementation of this using GET on Queries only similar to apollo in my own folk here, still needs more testing and I can't find a GraphQL endpoint that supports GET. Fortunately, it is a minor change, so completely backward compatible.
Here is how to turn it on.
final HttpLink _httpLink = HttpLink(
uri: '<URL>',
useGETForQueries: true,
);
U can build a local server with starwars-server
It鈥檚 also the server used in unit test of Apollo-iOS
https://github.com/apollographql/starwars-server
Simply run
git clone https://github.com/apollographql/starwars-server
cd starwars-server
npm install
npm start
It turns out using GET is not supported out of the box by apollo and also gqlgen for Go. I am working on enabling Automatic persisted queries on one of my Go GraphQL Servers and see if GET requests work.
Closed by #585