cli / cli/go-gh

`(*GraphQLClient).DoWithContext` should expose response headers such as `x-ratelimit-*`

Open
#220 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
438
Forks
94
Avg merge
5d 13h
Merged PRs (30d)
6

Description

`(*GraphQLClient).DoWithContext` currently reads and unmarshals the response body, but the original HTTP response headers are discarded.

Because of this, callers cannot access response headers such as `x-ratelimit-*` from GraphQL requests.

While rate limit information can sometimes be fetched via the GraphQL `rateLimit { ... }` field, that is only available when it can be included in the query response, and it is not a practical substitute in all cases. In particular, this does not help for mutations, where callers may still want to inspect the HTTP response headers directly.

It would be helpful if the method populated or exposed the response headers so rate limit information can be retrieved by callers.

**Relevant code**
- [`pkg/api/graphql_client.go`](https://github.com/cli/go-gh/blob/55692c6b904c06e3c01870fa81b326c2d0c88123/pkg/api/graphql_client.go#L57-L101)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.