File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Tests/AsyncHTTPClientTests Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -543,7 +543,8 @@ public final class ResponseAccumulator: HTTPClientResponseDelegate {
543543 let requestMethod : HTTPMethod
544544 let requestHost : String
545545
546- static let maxByteBufferSize = Int ( UInt32 . max)
546+ // This is either UInt32.max, or Int.max on platforms where that value is smaller.
547+ static let maxByteBufferSize = Int ( exactly: UInt32 . max) ?? Int ( Int32 . max)
547548
548549 /// Maximum size in bytes of the HTTP response body that ``ResponseAccumulator`` will accept
549550 /// until it will abort the request and throw an ``ResponseTooBigError``.
Original file line number Diff line number Diff line change @@ -946,6 +946,16 @@ class HTTP1ClientChannelHandlerTests: XCTestCase {
946946 ]
947947 )
948948 }
949+
950+ func testDefaultMaxBufferSize( ) {
951+ if MemoryLayout< Int> . size == 8 {
952+ XCTAssertEqual ( ResponseAccumulator . maxByteBufferSize, Int ( UInt32 . max) )
953+ } else if MemoryLayout< Int> . size == 4 {
954+ XCTAssertEqual ( ResponseAccumulator . maxByteBufferSize, Int ( Int32 . max) )
955+ } else {
956+ XCTFail ( " What platform is this? " )
957+ }
958+ }
949959}
950960
951961final class TestBackpressureWriter : Sendable {
You can’t perform that action at this time.
0 commit comments