Skip to content

Commit 610af18

Browse files
committed
debug output
1 parent 7f31443 commit 610af18

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Diff for: Tests/AsyncHTTPClientTests/HTTPClientTests.swift

+11-4
Original file line numberDiff line numberDiff line change
@@ -2069,10 +2069,17 @@ class HTTPClientTests: XCTestCase {
20692069
XCTAssertEqual(error as! HTTPClientError, HTTPClientError.bodyLengthMismatch)
20702070
}
20712071
// 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)
20762083
}
20772084

20782085
// currently gets stuck because of #250 the server just never replies

0 commit comments

Comments
 (0)