Skip to content

Commit d12311f

Browse files
committed
always use maxBytes
1 parent db0373b commit d12311f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Sources/AsyncHTTPClient/AsyncAwait/HTTPClientResponse+data.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import NIOCore
16-
import NIOHTTP1
1716
#if canImport(FoundationEssentials)
1817
import FoundationEssentials
1918
#else
@@ -27,8 +26,7 @@ extension HTTPClientResponse {
2726
/// - Parameter maxBytes: The maximum number of bytes this method is allowed to accumulate.
2827
/// - Returns: Bytes collected over time
2928
public func bytes(upTo maxBytes: Int) async throws -> ByteBuffer {
30-
let expectedBytes = self.headers.first(name: "content-length").flatMap(Int.init) ?? maxBytes
31-
return try await self.body.collect(upTo: min(expectedBytes, maxBytes))
29+
return try await self.body.collect(upTo: maxBytes)
3230
}
3331
}
3432

0 commit comments

Comments
 (0)