[Fix] GET Request are failing due to variablesKey cast that always fails.#624
[Fix] GET Request are failing due to variablesKey cast that always fails.#624dmandarino wants to merge 3 commits intoapollographql:masterfrom
Conversation
…irm with HTTPNetworkTransport
designatednerd
left a comment
There was a problem hiding this comment.
Looks like this is a limit on the keys I had in the tests for this. Can you please add a test for non-string keys to GETTransformerTests so we can make sure this doesn't regress in the future?
|
@designatednerd Sure, I'm taking a look on it. |
designatednerd
left a comment
There was a problem hiding this comment.
Test looks good, just gotta wait ♾️on CI!
|
@designatednerd it's still stucked. Is it usual to take that long? The other time it was so fast. |
|
Yeah during the day in the US the wait time for builds spikes pretty significantly, unfortunately. 😭 |
|
@dmandarino looks like there's a couple failures in there where occasionally the order of parameters is not the same. I'll take a longer look tomorrow but I suspect the dictionary you're encoding is being generated in a different order. I'm annoyed that |
| components.queryItems = queryItems | ||
|
|
||
| guard let variables = self.body.jsonObject[self.variablesKey] as? [String: AnyHashable] else { | ||
| guard let variables = self.body.jsonObject[self.variablesKey] as? [AnyHashable : Any] else { |
There was a problem hiding this comment.
So messing around in a playground then looking at the docs for JSONSerialization I think this needs to be [String: Any] - JSON Serialization barfs if the keys aren't strings.
|
Ugh, so I looked into this and getting I'm almost certainly going to move codegen stuff to I've opened #628 with my solution to this - do you mind if we move forward with that one since I've already dealt with the test nonsense? Your work here was absolutely critical to getting that to work, and I really appreciate it - I'll make sure this PR gets linked in the changelog! |
|
@designatednerd don't worry, just do it! I just wanted to help this project. We all need this feature, specially for persisted query. And I really need this GET, because right now I'm using a fork of my own so the company I'm working on can use Apollo Client for iOS. And if you don't mind, and if it helps, I can take a look in the other PR too. |
|
I don't mind at all - let me know what you think, and I'll close this one out. |
#623
GET request are always failing because of a cast for in [String: AnyHashable]
GraphQLGETTransformer. So I'm changing it to[AnyHashable : Any]because I've checked that it's the type we need to use to use custom headers too.