Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-collections.git", from: "1.6.0"),
.package(
url: "https://github.com/apple/swift-async-algorithms.git",
revision: "8ee3d2be1961950f94b6fa758477e3a0c5486aa9",
exact: "1.1.5",
traits: ["UnstableAsyncStreaming"]
),
.package(url: "https://github.com/apple/swift-http-types.git", from: "1.6.0"),
Expand All @@ -52,7 +52,8 @@ let package = Package(
.package(url: "https://github.com/apple/swift-configuration.git", from: "1.2.0"),
.package(
url: "https://github.com/swift-server/async-http-client.git",
revision: "a0ab90739bc856e7a097da8a4e71794aaaec651f"
exact: "1.35.0",
traits: ["UnstableHTTPAPIsSupport"]
),
],
targets: [
Expand Down
2 changes: 1 addition & 1 deletion Sources/AHCHTTPClient/AHC+HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//

@_spi(ExperimentalHTTPAPIsSupport) public import AsyncHTTPClient
public import AsyncHTTPClient
public import BasicContainers
import Foundation
@_exported public import HTTPAPIs
Expand Down
2 changes: 0 additions & 2 deletions Sources/HTTPClientConformance/HTTPClientConformance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,6 @@ struct ConformanceTestSuite<Client: HTTPClient & ~Copyable> {
)

// Read only a single byte from the body. We do not care about the rest of the 1Mb.
// The upstream `collect(upTo:)` now throws `AsyncReaderLeftOverElementsError`
// when the reader produces more elements than the limit, so we tolerate it.
try await client.perform(
request: request,
) { response, responseBodyAndTrailers in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ func serve(server: NIOHTTPServer) async throws {
}

// Parse the body as a UTF8 string and capture trailers
let (body, requestTrailers) = try await requestReader.collect(upTo: 1_000_000) { span in
String(copying: try UTF8Span(validating: span.span))
}
var bodyBuffer = UniqueArray<UInt8>(minimumCapacity: 1_000_000)
let requestTrailers = try await requestReader.collect(into: &bodyBuffer)
let body = String(copying: try UTF8Span(validating: bodyBuffer.span))

// Collect the trailers that were sent in with the request
var trailers: [String: [String]] = [:]
Expand Down
3 changes: 2 additions & 1 deletion Tests/HTTPAPIsTests/ServerCapabilityTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ struct ServerCapabilityTests {
body: nil
) { response, reader in
#expect(response.status == .ok)
_ = try await reader.collect(upTo: 100) { _ in }
var buffer = UniqueArray<UInt8>(minimumCapacity: 100)
_ = try await reader.collect(into: &buffer)
}

group.cancelAll()
Expand Down
Loading