-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text content type override ignored and defaults to json anyway #1569
Comments
This is actually related to this issue I raised last year: I remember the request body being encoded and not a text value. I got around it by setting the property above. After I closed the ticket this change was made which now causes the graphql queries to be treated as json (which it shouldn't): |
I've just checked the GraphQL spec, the recommendation when using it over HTTP is to use JSON encoded bodies. Is this not the case for you? What format is being used? If it is not JSON, then Pact will not be able to match it. |
Can you provide the full stack trace? |
I think it might be different for different language implementations. Here's the documentation for the GraphQL Java which shows a query syntax I'm using: https://www.graphql-java.com/documentation/batching Here's the stack trace:
|
Found the issue. If you change it to
it should work. But I will fix that. |
Sorry, my mistake. The slash should be the other way. |
Hey, I'm using below to override content type of application/graphql to text:
System.setProperty("pact.content_type.override.application.graphql", "text")
I can see the property being recognised, but I keep getting:
au.com.dius.pact.core.support.json.JsonException: Invalid JSON (1:3), found unexpected character 'd'
'd' is the beginning of the graphql query which is not a valid JSON and why I want to treat it like a text. I've narrowed down the problem to the below line in ContentType.kt where it somehow matches the application/graphql to the json via superType.subtype which it gets from MediaTypeRegistry.
https://github.com/pact-foundation/pact-jvm/blob/d3580fccd1254e87263656133bf96bbcd15b0b0e/core/model/src/main/kotlin/au/com/dius/pact/core/model/ContentType.kt#L28
is there anything I can do to stop this from being treated as json? i'm using the 4.3.8 version of pact-jvm
The text was updated successfully, but these errors were encountered: