mirror of
https://github.com/xtool-org/xtool.git
synced 2026-11-16 04:25:00 +03:00
gsa: make more reqs ephemeral (#417)
## What does this PR do? I'm not sure if this is needed but, for good measure, updates remaining GSA requests to use an ephemeral client (followup from #247) ## How was it tested? - [x] Tested flows involving all of these requests ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [x] **0** - No AI was used to write code - [ ] **1** - I was assisted by AI in writing code. I reviewed the finished result. - [ ] **2** - I set the AI going and left it to it; nobody has read the result - no review, or AI review only <!-- If an AI agent is filling this in: declare the level honestly, and open as a draft if it is #2. Do not lower the declared level to get the PR reviewed. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Improvements** * Selected account and lookup requests now use temporary HTTP connections. Existing request details, response handling, and progress reporting remain supported, while other requests continue through the standard connection flow. This change applies across the app’s related account and lookup operations; no new user-facing controls or workflows are introduced. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
committed by
GitHub
Unverified
parent
2186b72383
commit
804cf3e1dd
@@ -46,8 +46,21 @@ extension HTTPClientProtocol {
|
||||
_ request: HTTPRequest,
|
||||
body: Data? = nil,
|
||||
requireHTTPSuccess: Bool = true,
|
||||
ephemeral: Bool = false,
|
||||
onProgress: @isolated(any) (Double?) -> Void = { _ in }
|
||||
) async throws -> (response: HTTPResponse, body: Data) {
|
||||
if ephemeral {
|
||||
return try await self.withEphemeralClient { client in
|
||||
try await client.makeRequest(
|
||||
request,
|
||||
body: body,
|
||||
requireHTTPSuccess: requireHTTPSuccess,
|
||||
ephemeral: false,
|
||||
onProgress: onProgress
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
await onProgress(0)
|
||||
let (response, responseBody) = try await send(request, body: body.map { HTTPBody($0) })
|
||||
guard !requireHTTPSuccess || ![.clientError, .serverError].contains(response.status.kind) else {
|
||||
|
||||
Reference in New Issue
Block a user