Prep for 1.0 alpha, adapted to runtime changes in main#25
Prep for 1.0 alpha, adapted to runtime changes in main#25czechboy0 merged 1 commit intoswift-server:mainfrom
Conversation
| switch body.length { | ||
| case .unknown: length = .unknown | ||
| case .known(let count): length = .known(count) | ||
| case .known(let count): length = .known(Int(count)) |
There was a problem hiding this comment.
Converting from Int64 to Int can trap. We should throw an error instead.
There was a problem hiding this comment.
We're matching the AHC response header parsing behavior: https://github.com/swift-server/async-http-client/blob/c70e0856797ef826ff13627790241011f831975f/Sources/AsyncHTTPClient/AsyncAwait/HTTPClientResponse.swift#L135
If AHC changes to throwing errors, we should update the transport too.
There was a problem hiding this comment.
Yes but no 😄 The code you linked is about parsing the content-length header and a couple lines below you are doing it like AHC. However, we are not looking at the conten-length parsing code right now. This is converting the user defined known size of the request body from an Int64 to an Int which AHC doesn't do at all right now.
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.