Method graphql_sync
returns success=True although there is errors
#543
Replies: 1 comment 1 reply
-
Generally speaking for GraphQL servers its accepted that HTTP code different than 200 means that query wasn't executed at all, not that it was executed with errors. HTTP status codes aren't used by in GraphQL client/server communication, and this is reflected by API design of GraphQL client libs in wild. Don't rely on them in your communication implementation or you'll end fighting the stack. There's also a separate discussion on relying on |
Beta Was this translation helpful? Give feedback.
-
Hello everyone. I have a question regarding the graphql_sync method.
When I try this query:
the method
graphql_sync
returns(False, {'errors': [{'message': 'String cannot represent a non string value: 1', 'locations': [{'line': 3, 'column': 25}], 'path': None}]}
which is right, because the code needs to be a string. But when I try to use variables like this:with variables like this:
the method
graphql_sync
returns(True, {'data': None, 'errors': [{'message': "Variable '$data' got invalid value 1 at 'data.code'; String cannot represent a non string value: 1", 'locations': [{'line': 1, 'column': 7}], 'path': None}]}
Why this behaves differently? I wanted to use the success flag to change the status code of response like it said here:
https://ariadne.readthedocs.io/en/0.3.0/custom-server.html. But this different behaviour makes it inconsistent. Did I get something wrong here?
Many thanks for the help.
Beta Was this translation helpful? Give feedback.
All reactions