Closed galdiuz closed 2 years ago
I should note that I added this in the most simple way possible, as I was unsure if it would be more appropriate to use QueryHelper.build
. If you think that is a better way I could change to use that instead.
Thank you @galdiuz! Could you add some test cases to exercise the new code path?
I believe the test file to add the cases to would be https://github.com/dillonkearns/elm-graphql/blob/63de2e2868bbdff43eb9e4d109114ff34a00e45e/tests/Http/QueryHelperTests.elm.
Ah yes, having that logic in QueryHelper.build
does seem like a good idea. That way the logic is co-located. The Http
module should just be delegating to outside for the logic on how to construct the URL with the query in it, so yes please do make that change 🙏
After reading through and actually understanding QueryHelper
I believe that Mutations actually don't need to use it. As I understand QueryHelper
solves the issue of selecting between GET
and POST
and building the URL and body as appropriate, but since Mutations are always POST
they have no need for this logic. I could add a buildMutation
to QueryHelper
or create a new MutationHelper
, but any code within it would basically only be a copy of what's already in the Mutation
branch of Http.toReadyRequest
so it feels unnecessary. If you disagree and would rather have it separated I'd be up for writing that code and any associated tests though, so please let me know what you think.
Bump @dillonkearns. You're usually quick to respond so I figured you might've missed my response (and I apologize if that isn't the case).
Yeah, looks like the concerns are mixed between those two modules a bit already, so the addition in the Http module for now seems good 👍 Thanks for the PR!
@dillonkearns Could you please add a new tag so that this is available in Elm Packages?
The fix is live in version 5.0.7 now 👍 Thanks again for the PR!
https://github.com/dillonkearns/elm-graphql/blob/master/CHANGELOG-ELM-PACKAGE.md#507---2021-10-26
Closes #565.
Here is a PR to add operationName to Mutation requests. Please let me know if there's anything you want me to change.