Skip to content

Commit e2faaee

Browse files
committed
Fix tests
1 parent dffcb48 commit e2faaee

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Tests/AsyncHTTPClientTests/AsyncAwaitEndToEndTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,14 @@ final class AsyncAwaitEndToEndTests: XCTestCase {
539539

540540
let localClient = HTTPClient(eventLoopGroupProvider: .createNew, configuration: config)
541541
defer { XCTAssertNoThrow(try localClient.syncShutdown()) }
542-
let request = HTTPClientRequest(url: "https://example.com:\(bin.port)/echo-headers")
542+
let request = HTTPClientRequest(url: "https://example.com:\(bin.port)/echohostheader")
543543
let response = await XCTAssertNoThrowWithResult(try await localClient.execute(request, deadline: .now() + .seconds(2)))
544544
XCTAssertEqual(response?.status, .ok)
545545
XCTAssertEqual(response?.version, .http2)
546+
var body = try await response?.body.collect(upTo: 1024)
547+
let readableBytes = body?.readableBytes ?? 0
548+
let responseInfo = try body?.readJSONDecodable(RequestInfo.self, length: readableBytes)
549+
XCTAssertEqual(responseInfo?.data, "example.com\(bin.port == 443 ? "" : ":\(bin.port)")")
546550
}
547551
}
548552

Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ internal final class HTTPBin<RequestHandler: ChannelInboundHandler> where
343343
)
344344

345345
static func http1_1(ssl: Bool, compress: Bool = false) -> Self {
346-
.http1_1(tlsConfiguration: ssl ? nil : TestTLS.serverConfiguration, compress: compress)
346+
.http1_1(tlsConfiguration: ssl ? TestTLS.serverConfiguration : nil, compress: compress)
347347
}
348348

349349
// supports request decompression and http response compression

0 commit comments

Comments
 (0)