anteon icon indicating copy to clipboard operation
anteon copied to clipboard

How can the response of GraphQL inner http status codes be examined?

Open bigman73 opened this issue 1 year ago • 2 comments

GraphQL operations that fail still return a 200 HTTP status code even if the inner resolvers fail How can ddosify be used with GraphQL operations?

I'd like to see ddosify fail when inner GraphQL resolvers fail. Right now there's a success for failed executions since the GraphQL response is 200 on the external response.

bigman73 avatar Aug 26 '22 16:08 bigman73

Hi @bigman73

Currently success/fail logic is simple. If Ddosify receives the response, that is a successful request/response cycle. If somehow a request couldn't send or response couldn't received (like timeout) then it is a failed cycle.

Ddosify provides HTTP response codes to let the developer parse it and create their own assertion logic. Using stdout-json as the output type makes this process simpler.

We'll implement a custom assertion logic, so you can easily create your own success/fail criteria. Like, if the response body containsr/regex/ then mark the request as failed, etc. I think that's what you are looking for. If so, could you please provide your use case with an example? This will make the development more targeted to solve your issue.

kursataktas avatar Aug 28 '22 21:08 kursataktas

Hi @kursataktas Thanks for your prompt reply. For GraphQL the HTTP response code won't help because it is 200 even if the inner resolvers return errors.

A custom regular expression seems like a very good solution. It should be easy to create custom 'rules' with regex.

bigman73 avatar Aug 28 '22 21:08 bigman73