File tree 1 file changed +11
-4
lines changed
Tests/AsyncHTTPClientTests
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -2069,10 +2069,17 @@ class HTTPClientTests: XCTestCase {
2069
2069
XCTAssertEqual ( error as! HTTPClientError , HTTPClientError . bodyLengthMismatch)
2070
2070
}
2071
2071
// Quickly try another request and check that it works.
2072
- 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 )
2072
+ let response = try self . defaultClient. get ( url: self . defaultHTTPBinURLPrefix + " get " ) . wait ( )
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 )
2076
2083
}
2077
2084
2078
2085
// currently gets stuck because of #250 the server just never replies
You can’t perform that action at this time.
0 commit comments