Skip to content

feat!: Refactor request context#4151

Draft
stevehipwell wants to merge 1 commit intogoogle:masterfrom
stevehipwell:request-context-refactor
Draft

feat!: Refactor request context#4151
stevehipwell wants to merge 1 commit intogoogle:masterfrom
stevehipwell:request-context-refactor

Conversation

@stevehipwell
Copy link
Copy Markdown
Contributor

Closes #4127
Related to #3915

This PR makes the following changes:

  • Switch to using http.NewRequestWithContext so we no longer need the withContext helper
  • Refactor all HTTP calls to use client.BareDo to get benefits such as rate limit
  • Refactor DownloadReleaseAsset to use bareDoUntilFound instead of mutating the global client to block redirects
  • Remove Google App Engine Classic (Go < 1.12) support (removed appengine build tag)

Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
@stevehipwell stevehipwell force-pushed the request-context-refactor branch from 691467f to 361db80 Compare April 14, 2026 13:03
Comment on lines +94 to 100
req, err := s.client.NewRequest(ctx, "GET", u, nil)
if err != nil {
return nil, nil, err
}

var artifactList *ArtifactList
resp, err := s.client.Do(ctx, req, &artifactList)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit odd that both NewRequest and Do accept ctx.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, but the logic for per request rate limiting uses the context. I could refactor it to use req.Context() but that seems like additional overhead when the context is already available to be passed in.

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Apr 14, 2026
@stevehipwell stevehipwell marked this pull request as draft April 14, 2026 13:08
@stevehipwell
Copy link
Copy Markdown
Contributor Author

@gmlewis I'm going to completely rebase this PR as I need to split it into 3.

@stevehipwell
Copy link
Copy Markdown
Contributor Author

#4152 replaces the app engine removal part of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request context question

3 participants