Repository navigation
refactor(client): return the response body from DoRequest of client/http - #112
Merged
Merged
Conversation
|
Coverage of the acceptance run against the meshStack backend, on
Uncovered functions
|
client/http has one DoRequest, which returns the response body, and UnmarshalJsonBody, ReadAllBody and IgnoreResponse consume it. Request options set the retry policy, refuse redirects and capture the response header. A GET and a DELETE are retried on every transient failure, any other method on 423, 429 and 503; the state store of tfstate retries no 423, so that tofu sees the holder of a lock at once. The debug log shows the first 1024 bytes of a body as they came. An http.Error names the method and the URL. An Authorization is a fmt.Stringer, which a 403 names, and BearerToken.String redacts the token. AuthorizedClient.ProxyTransport replaces internal/tfstate/apiproxy. Download is gone. internal/json is the only importer of encoding/json/v2. client/internal, client.RawClient and the run action client adapt to DoRequest only as far as they need to keep working, and internal/apidocs downloads the API docs on every command: the next changes replace both. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
grubmeshi
force-pushed
the
http-do-request
branch
from
November 25, 2026 12:22
ff0a922 to
dd3601f
Compare
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What it does
http.Client.DoRequestandhttp.AuthorizedClient.DoRequestreturn the response body.UnmarshalJsonBody,ReadAllBodyandIgnoreResponseread it and close it. The genericDoRequest[R]is gone.Retryable(RetryOn…)), refuse redirects (WithoutRedirects) and capture the response header (WithCapturedResponseHeader). A GET and a DELETE are retried on every transient failure, any other method on 423, 429 and 503. The retries outlast a restart of meshStack.http.Errornames the method and URL.http.Authorizationis afmt.Stringerin place ofScope, and a 403 names it.BearerToken.Stringredacts the token.AuthorizedClient.ProxyTransportreplacesinternal/tfstate/apiproxy. The state store does not retry a 423, so that tofu sees the holder of a lock at once.client/http/download.gois gone.internal/jsonis the only importer ofencoding/json/v2.Review carefully
client/http/http_client.go,options.go,retry.go,logging.go,auth.go.internal/tfstate/store.go(retry policy of the state calls) andproxy.go.Temporary glue
client/internal/mesh_object.go,client/raw.go,client/building_block_run_action.goand theRawClientcallers adapt to the newDoRequestwith as few changes as possible.generic-mesh-object-clientdeletes all of them. Untilapidocs-etag,internal/apidocsdownloads the API docs on every command.Mechanical
The import changes from
encoding/json/v2tointernal/json, and the callers of the old options (WithAccept,WithHeaders,WithBody,WithJsonPayload,WithFormPayload).Place in the stack
3 of 6. Base:
profile-resolution. Next:apidocs-etag.🤖 Generated with Claude Code