diff --git a/Sources/XKit/HTTPClientProtocol/HTTPClientProtocol.swift b/Sources/XKit/HTTPClientProtocol/HTTPClientProtocol.swift index a4750576..503a0036 100644 --- a/Sources/XKit/HTTPClientProtocol/HTTPClientProtocol.swift +++ b/Sources/XKit/HTTPClientProtocol/HTTPClientProtocol.swift @@ -45,12 +45,12 @@ extension HTTPClientProtocol { public func makeRequest( _ request: HTTPRequest, body: Data? = nil, - throwOnServerError: Bool = true, + requireHTTPSuccess: Bool = true, onProgress: @isolated(any) (Double?) -> Void = { _ in } ) async throws -> (response: HTTPResponse, body: Data) { await onProgress(0) let (response, responseBody) = try await send(request, body: body.map { HTTPBody($0) }) - guard !throwOnServerError || response.status.kind != .serverError else { + guard !requireHTTPSuccess || ![.clientError, .serverError].contains(response.status.kind) else { let errorBody = (try? await responseBody.collect()) ?? Data() throw HTTPResponseError( method: request.method,