Add support for client that uses GET as transport mechanism (#186)

Current implementation always uses POST as the transport mechanism. Adding GET support enables usage of GET queries for caching simply via URL.

Some notes:
- I left the existing API for creating a new client as is, but the implementation could be much cleaner by introducing some sort of configuration struct when creating a new client
- The construction of the query parameters follows the logic from Apollo's client implementation, which can be found here https://github.com/apollographql/apollo-client/blob/8beb4820edc6352996e08f7f73bde3573f1eb666/src/link/http/rewriteURIForGET.ts
- Updated integration tests to use both sets of clients. Updating the tests to use a test suite would be cleaner
This commit is contained in:
salman-rb
2022-04-13 16:16:27 -07:00
committed by GitHub
parent b2422452a1
commit 39a980ab4e
10 changed files with 798 additions and 335 deletions
+8
View File
@@ -12,6 +12,10 @@ type Query {
fail: Boolean
}
type Mutation {
createUser(input: NewUser!): User!
}
type User implements Being & Lucky {
id: ID!
name: String!
@@ -21,6 +25,10 @@ type User implements Being & Lucky {
friends: [User!]!
}
input NewUser {
name: String!
}
type Hair { color: String } # silly name to confuse the name-generator
type Animal implements Being {