mirror of
https://github.com/apple/swift-nio
synced 2026-11-30 05:28:44 +00:00
Remove ByteBufferAllocator constructor argument from HttpResponseEncoder
Motivation: We can allocate the buffer on the fly if needed, no need to add the constructor argument. Modifications: Just allocate the buffer in the methods itself that need it. Result: Easier to construct encoder and cleaner code.
This commit is contained in:
1 parent
4e04a275c0
commit
c22e5ead6b
5 files changed
+36
-35
No files matched your search
@@ -29,7 +29,7 @@ class HTTPEncoderTests: XCTestCase {
|
||||
XCTAssertFalse(try! channel.finish())
|
||||
}
|
||||
|
||||
try! channel.pipeline.add(handler: HTTPResponseEncoder(allocator: channel.allocator)).wait()
|
||||
try! channel.pipeline.add(handler: HTTPResponseEncoder()).wait()
|
||||
var switchingResponse = HTTPResponseHead(version: HTTPVersion(major: 1, minor:1), status: status)
|
||||
switchingResponse.headers = headers
|
||||
try! channel.writeOutbound(data: HTTPResponsePart.head(switchingResponse))
|
||||
@@ -98,7 +98,7 @@ class HTTPEncoderTests: XCTestCase {
|
||||
XCTAssertFalse(try! channel.finish())
|
||||
}
|
||||
|
||||
try! channel.pipeline.add(handler: HTTPResponseEncoder(allocator: channel.allocator)).wait()
|
||||
try! channel.pipeline.add(handler: HTTPResponseEncoder()).wait()
|
||||
|
||||
// This response contains neither Transfer-Encoding: chunked or Content-Length.
|
||||
let response = HTTPResponseHead(version: HTTPVersion(major: 1, minor:0), status: .ok)
|
||||
|
||||
Reference in new issue
Block a user