Skip to content

Commit

Permalink
Return GraphQL response as GdsApi::Response
Browse files Browse the repository at this point in the history
This is instead of `Hash`.

In Government Frontend, we need some other information from the request
response (e.g. the cache control headers) which are not included when
the response is converted to a hash.

This is not a breaking change as the new object type accepts the same
methods as the hash.
  • Loading branch information
brucebolt committed Dec 2, 2024
1 parent f5c0bfc commit e59d3f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/gds_api/publishing_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,9 @@ def get_schema(schema_name)
#
# @param query [String]
#
# @return [Hash] A response with the result of the GraphQL query.
# @return [GdsApi::Response] A response with the result of the GraphQL query.
def graphql_query(query)
post_json("#{endpoint}/graphql", query:).to_hash
post_json("#{endpoint}/graphql", query:)
end

private
Expand Down
2 changes: 1 addition & 1 deletion test/test_helpers/publishing_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@

assert_equal(
stubbed_response.to_json,
api_response.to_json,
api_response.raw_response_body,
)
end
end
Expand Down

0 comments on commit e59d3f4

Please sign in to comment.