File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Tests/AsyncHTTPClientTests Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -2070,9 +2070,16 @@ class HTTPClientTests: XCTestCase {
20702070 }
20712071 // Quickly try another request and check that it works.
20722072 var response = try self . defaultClient. get ( url: self . defaultHTTPBinURLPrefix + " get " ) . wait ( )
2073- let info = try response. body!. readJSONDecodable ( RequestInfo . self, length: response. body!. readableBytes)
2074- XCTAssertEqual ( info!. connectionNumber, 1 )
2075- XCTAssertEqual ( info!. requestNumber, 1 )
2073+ guard var body = response. body else {
2074+ XCTFail ( " Body missing: \( response) " )
2075+ return
2076+ }
2077+ guard let info = try body. readJSONDecodable ( RequestInfo . self, length: body. readableBytes) else {
2078+ XCTFail ( " Cannot parse body: \( body. readableBytesView. map { $0 } ) " )
2079+ return
2080+ }
2081+ XCTAssertEqual ( info. connectionNumber, 1 )
2082+ XCTAssertEqual ( info. requestNumber, 1 )
20762083 }
20772084
20782085 // currently gets stuck because of #250 the server just never replies
You can’t perform that action at this time.
0 commit comments