mirror of
https://github.com/apple/swift-nio
synced 2026-11-27 05:04:22 +00:00
prepare tests for throwing readIn/Outbound (#861)
Motivation: readInbound/Outbound will soon throw errors if the type isn't right. Modifications: prepare tests for throwing readIn/Outbound Result: @ianpartridge's PR should pretty much merge after this.
This commit is contained in:
1 parent
49659664c2
commit
a1981eb0fd
16 files changed
+328
-288
No files matched your search
@@ -133,7 +133,7 @@ class HTTPDecoderLengthTest: XCTestCase {
|
||||
|
||||
// Prime the decoder with a GET and consume it.
|
||||
XCTAssertTrue(try channel.writeOutbound(HTTPClientRequestPart.head(HTTPRequestHead(version: version, method: .GET, uri: "/"))))
|
||||
XCTAssertNotNil(channel.readOutbound(as: ByteBuffer.self))
|
||||
XCTAssertNoThrow(XCTAssertNotNil(try channel.readOutbound(as: ByteBuffer.self)))
|
||||
|
||||
// We now want to send a HTTP/1.1 response. This response has no content-length, no transfer-encoding,
|
||||
// is not a response to a HEAD request, is not a 2XX response to CONNECT, and is not 1XX, 204, or 304.
|
||||
@@ -198,7 +198,7 @@ class HTTPDecoderLengthTest: XCTestCase {
|
||||
XCTAssertTrue(try channel.writeOutbound(HTTPClientRequestPart.head(HTTPRequestHead(version: .init(major: 1, minor: 1),
|
||||
method: requestMethod,
|
||||
uri: "/"))))
|
||||
XCTAssertNotNil(channel.readOutbound(as: ByteBuffer.self))
|
||||
XCTAssertNoThrow(XCTAssertNotNil(try channel.readOutbound(as: ByteBuffer.self)))
|
||||
|
||||
// We now want to send a HTTP/1.1 response. This response may contain some length framing fields that RFC 7230 says MUST
|
||||
// be ignored.
|
||||
@@ -337,7 +337,7 @@ class HTTPDecoderLengthTest: XCTestCase {
|
||||
XCTAssertTrue(try channel.writeOutbound(HTTPClientRequestPart.head(HTTPRequestHead(version: .init(major: 1, minor: 1),
|
||||
method: .GET,
|
||||
uri: "/"))))
|
||||
XCTAssertNotNil(channel.readOutbound(as: ByteBuffer.self))
|
||||
XCTAssertNoThrow(XCTAssertNotNil(try channel.readOutbound(as: ByteBuffer.self)))
|
||||
|
||||
// Send a 200 with the appropriate Transfer Encoding header. We should see the request,
|
||||
// but no body or end.
|
||||
|
||||
Reference in new issue
Block a user