-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set User-Agent header on both REST and graphql requests
In #256 we starting setting a custom User-Agent header on REST API calls, to help us understand the ways our API is used. It looks like this: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.0.3 buildkite/0.15.0 This builds on that work and sets the same User-Agent on graphql API requests as well. It drops the unnescary use of golang.org/x/oauth2 to set a static bearer token header, and uses the tripperware pattern [1] to set both headers we care about: 1. the static bearer token for auth 2. the user agent The same http.Client is used for both REST and graphql, so we'll get identical behaviour on both APIs. [1] https://dev.to/stevenacoffman/tripperwares-http-client-middleware-chaining-roundtrippers-3o00
- Loading branch information
Showing
2 changed files
with
38 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters