graphqlite
graphqlite copied to clipboard
graphql api returns 500 http codes on unknown types
Hey there,
query foobar($foobar: Foobar!){
foobar(foobar: $foobar){
foobar
}
}
Calling this query on an environment that has no Foobar
type defined results in a 500 http response like in this screenshot.
Is it normal? Shouldn't it be a 400 response?
Yes. I think there are a few cases where the http response codes aren't being properly set. Care to submit a pull request?
I'll try to find some time for this one! Not sure when :/
@massimilianobraglia be a great time to get a PR merged in. Thanks.
I'll try to solve this issue. @oojacoboo any suggestions about the test case?
@sebcar I think an example like the one mentioned should be sufficient here. There are a few other cases as well, where GQL syntax results in a 500. I'm not sure of all these cases though. GraphQLite uses Webonyx's GQL parser under the hood. I don't think we'll be able to wrap that in a try/catch either, unless there is a specific Exception being thrown for these parsing errors.
I can't find a way in the test case to get the execution result for CannotMapTypeException
@sebcar If there is an exception being thrown, why would there be a result? Presumably, execution was halted before there was a result.
@oojacoboo that is true. I was trying to use the HttpCodeDeciderTest