12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
- // TODO: remove @testable once we officially support HTTP/2
16
- @testable import AsyncHTTPClient // Tests that really need @testable go into HTTP2ClientInternalTests.swift
15
+ /* NOT @testable */ import AsyncHTTPClient // Tests that really need @testable go into HTTP2ClientInternalTests.swift
17
16
#if canImport(Network)
18
17
import Network
19
18
#endif
@@ -28,14 +27,13 @@ class HTTP2ClientTests: XCTestCase {
28
27
func makeDefaultHTTPClient(
29
28
eventLoopGroupProvider: HTTPClient . EventLoopGroupProvider = . createNew
30
29
) -> HTTPClient {
31
- var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
32
- tlsConfig. certificateVerification = . none
30
+ var config = HTTPClient . Configuration ( )
31
+ config. tlsConfiguration = . clientDefault
32
+ config. tlsConfiguration? . certificateVerification = . none
33
+ config. httpVersion = . automatic
33
34
return HTTPClient (
34
35
eventLoopGroupProvider: eventLoopGroupProvider,
35
- configuration: HTTPClient . Configuration (
36
- tlsConfiguration: tlsConfig,
37
- httpVersion: . automatic
38
- ) ,
36
+ configuration: config,
39
37
backgroundActivityLogger: Logger ( label: " HTTPClient " , factory: StreamLogHandler . standardOutput ( label: ) )
40
38
)
41
39
}
@@ -138,14 +136,13 @@ class HTTP2ClientTests: XCTestCase {
138
136
139
137
let localHTTPBin = HTTPBin ( . http2( compress: false ) )
140
138
let elg = MultiThreadedEventLoopGroup ( numberOfThreads: numberOfWorkers)
141
- var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
142
- tlsConfig. certificateVerification = . none
139
+ var config = HTTPClient . Configuration ( )
140
+ config. tlsConfiguration = . clientDefault
141
+ config. tlsConfiguration? . certificateVerification = . none
142
+ config. httpVersion = . automatic
143
143
let localClient = HTTPClient (
144
144
eventLoopGroupProvider: . shared( elg) ,
145
- configuration: HTTPClient . Configuration (
146
- tlsConfiguration: tlsConfig,
147
- httpVersion: . automatic
148
- ) ,
145
+ configuration: config,
149
146
backgroundActivityLogger: Logger ( label: " HTTPClient " , factory: StreamLogHandler . standardOutput ( label: ) )
150
147
)
151
148
defer {
@@ -303,15 +300,14 @@ class HTTP2ClientTests: XCTestCase {
303
300
let el1 = clientGroup. next ( )
304
301
let el2 = clientGroup. next ( )
305
302
defer { XCTAssertNoThrow ( try clientGroup. syncShutdownGracefully ( ) ) }
306
- var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
307
- tlsConfig. certificateVerification = . none
303
+ var config = HTTPClient . Configuration ( )
304
+ config. tlsConfiguration = . clientDefault
305
+ config. tlsConfiguration? . certificateVerification = . none
306
+ config. httpVersion = . automatic
307
+ config. timeout. connect = . milliseconds( 1000 )
308
308
let client = HTTPClient (
309
309
eventLoopGroupProvider: . shared( clientGroup) ,
310
- configuration: HTTPClient . Configuration (
311
- tlsConfiguration: tlsConfig,
312
- timeout: . init( connect: . milliseconds( 1000 ) ) ,
313
- httpVersion: . automatic
314
- ) ,
310
+ configuration: config,
315
311
backgroundActivityLogger: Logger ( label: " HTTPClient " , factory: StreamLogHandler . standardOutput ( label: ) )
316
312
)
317
313
defer { XCTAssertNoThrow ( try client. syncShutdown ( ) ) }
0 commit comments