Skip to content
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

Return status for HTTP errors in errors extensions #28

Merged
merged 1 commit into from
Aug 31, 2018

Conversation

pbostrom
Copy link
Contributor

PR to return HTTP status codes as discussed in #27.
When an HTTP error occurs, re-graph will insert the HTTP status into the response according to 3 conditions:

  • Response contains a valid GraphQL errors map: update the map with HTTP status
  • Response is a map but does not contain a valid errors map: merge in default errors map
  • Response is anything else: return default errors map

where the default errors map is:

{:errors [{:message "The HTTP call failed."
           :extensions {:status status}}]}

4 test cases were added

  • Query error with invalid graphql response (string body)
  • Query error with invalid graphql response (map body)
  • Query error with valid graphql error response
  • No query error

@oliyh oliyh merged commit e83839c into oliyh:master Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants