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 HTTPResponseEncoderTests: XCTestCase {
private func sendResponse(withStatus status: HTTPResponseStatus, andHeaders headers: HTTPHeaders) -> ByteBuffer {
let channel = EmbeddedChannel()
defer {
XCTAssertEqual(.some(false), try? channel.finish())
XCTAssertEqual(true, try? channel.finish().isClean)
}
XCTAssertNoThrow(try channel.pipeline.addHandler(HTTPResponseEncoder()).wait())
@@ -102,7 +102,7 @@ class HTTPResponseEncoderTests: 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(HTTPResponseEncoder()).wait())