GraphQL reports query errors in the body of an HTTP 200, as a top-level
errors array, so a 2xx status is not enough to call a call successful.
Arguments
- res
An envelope from
post_json()orperform().- source
A friendly label for the service.
Details
Returns an error envelope for either kind of failure, transport or query, so a GraphQL client collapses the two checks into one:
res <- post_json(url, body, source = "gnomAD")
bad <- graphql_error(res, "gnomAD")
if (!is.null(bad)) return(bad)