gsa: make more reqs ephemeral

This commit is contained in:
Kabir Oberai
2026-10-30 21:28:23 -04:00
Unverified
parent 705931b3a4
commit d54d3345da
4 changed files with 16 additions and 5 deletions
@@ -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 {