@@ -487,8 +487,9 @@ class HTTPClientTests: XCTestCase {
487487
488488 func testEventLoopArgument( ) throws {
489489 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 ) )
492493 defer {
493494 try ! eventLoopGroup. syncShutdownGracefully ( )
494495 httpBin. shutdown ( )
@@ -516,9 +517,13 @@ class HTTPClientTests: XCTestCase {
516517
517518 let eventLoop = eventLoopGroup. next ( )
518519 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)
521523
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 ( )
522527 XCTAssertEqual ( true , response)
523528 }
524529}
0 commit comments