@@ -487,8 +487,9 @@ class HTTPClientTests: XCTestCase {
487
487
488
488
func testEventLoopArgument( ) throws {
489
489
let httpBin = HttpBin ( )
490
- let eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
491
- let httpClient = HTTPClient ( eventLoopGroupProvider: . shared( eventLoopGroup) )
490
+ let eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 5 )
491
+ let httpClient = HTTPClient ( eventLoopGroupProvider: . shared( eventLoopGroup) ,
492
+ configuration: HTTPClient . Configuration ( followRedirects: true ) )
492
493
defer {
493
494
try ! eventLoopGroup. syncShutdownGracefully ( )
494
495
httpBin. shutdown ( )
@@ -516,9 +517,13 @@ class HTTPClientTests: XCTestCase {
516
517
517
518
let eventLoop = eventLoopGroup. next ( )
518
519
let delegate = EventLoopValidatingDelegate ( eventLoop: eventLoop)
519
- let request = try HTTPClient . Request ( url: " http://localhost: \( httpBin. port) /get " )
520
- let response = try httpClient. execute ( request: request, delegate: delegate, eventLoop: . prefers( eventLoop) ) . wait ( )
520
+ var request = try HTTPClient . Request ( url: " http://localhost: \( httpBin. port) /get " )
521
+ var response = try httpClient. execute ( request: request, delegate: delegate, eventLoop: . prefers( eventLoop) ) . wait ( )
522
+ XCTAssertEqual ( true , response)
521
523
524
+ // redirect
525
+ request = try HTTPClient . Request ( url: " http://localhost: \( httpBin. port) /redirect/302 " )
526
+ response = try httpClient. execute ( request: request, delegate: delegate, eventLoop: . prefers( eventLoop) ) . wait ( )
522
527
XCTAssertEqual ( true , response)
523
528
}
524
529
}
0 commit comments