mirror of
https://github.com/swift-server/swift-openapi-async-http-client.git
synced 2026-06-02 07:47:33 +00:00
Prep for 1.0 alpha, adapted to runtime changes in main (#25)
### Motivation On main, the HTTPBody length type changed from Int to Int64. ### Modifications Adapted the transport with this change. ### Result Repo builds again when using the latest runtime. ### Test Plan Adapted tests.
This commit is contained in:
@@ -181,7 +181,7 @@ public struct AsyncHTTPClientTransport: ClientTransport {
|
||||
let length: HTTPClientRequest.Body.Length
|
||||
switch body.length {
|
||||
case .unknown: length = .unknown
|
||||
case .known(let count): length = .known(count)
|
||||
case .known(let count): length = .known(Int(count))
|
||||
}
|
||||
clientRequest.body = .stream(body.map { .init(bytes: $0) }, length: length)
|
||||
}
|
||||
@@ -197,7 +197,7 @@ public struct AsyncHTTPClientTransport: ClientTransport {
|
||||
for header in httpResponse.headers { headerFields[.init(header.name)!] = header.value }
|
||||
|
||||
let length: HTTPBody.Length
|
||||
if let lengthHeaderString = headerFields[.contentLength], let lengthHeader = Int(lengthHeaderString) {
|
||||
if let lengthHeaderString = headerFields[.contentLength], let lengthHeader = Int64(lengthHeaderString) {
|
||||
length = .known(lengthHeader)
|
||||
} else {
|
||||
length = .unknown
|
||||
|
||||
Reference in New Issue
Block a user