EmbeddedChannel: remove mystery bools (#917)

Motivation:

EmbeddedChannel.finish/writeInbound/writeOutbound returned some mystery
bools. I always had to check the code to remember what they actually
meaned.

Whilst this is technically a breaking change, I couldn't find any users
of the return values on Github that are using the convergence releases.

Modifications:

Replace them by enums giving you all the information.

Result:

- fixes #916
- clearer APIs
This commit is contained in:
Johannes Weiss authored and GitHub committed 2019-03-22 12:34:16 +00:00
1 parent 169f34adfc
commit a8fbcf080b
14 files changed
+168 -106

No files matched your search

@@ -26,7 +26,7 @@ class HTTPRequestEncoderTests: XCTestCase {
private func sendRequest(withMethod method: HTTPMethod, andHeaders headers: HTTPHeaders) throws -> ByteBuffer {
let channel = EmbeddedChannel()
defer {
XCTAssertEqual(.some(false), try? channel.finish())
XCTAssertEqual(true, try? channel.finish().isClean)
}
try channel.pipeline.addHandler(HTTPRequestEncoder()).wait()
@@ -75,7 +75,7 @@ class HTTPRequestEncoderTests: XCTestCase {
func testNoChunkedEncodingForHTTP10() throws {
let channel = EmbeddedChannel()
defer {
XCTAssertEqual(.some(false), try? channel.finish())
XCTAssertEqual(true, try? channel.finish().isClean)
}
XCTAssertNoThrow(try channel.pipeline.addHandler(HTTPRequestEncoder()).wait())
@@ -91,7 +91,7 @@ class HTTPRequestEncoderTests: XCTestCase {
func testBody() throws {
let channel = EmbeddedChannel()
defer {
XCTAssertEqual(.some(false), try? channel.finish())
XCTAssertEqual(true, try? channel.finish().isClean)
}
try channel.pipeline.addHandler(HTTPRequestEncoder()).wait()
@@ -113,7 +113,7 @@ class HTTPRequestEncoderTests: XCTestCase {
func testCONNECT() throws {
let channel = EmbeddedChannel()
defer {
XCTAssertEqual(.some(false), try? channel.finish())
XCTAssertEqual(true, try? channel.finish().isClean)
}
let uri = "server.example.com:80"