async-http-client
async-http-client copied to clipboard
implement new streamwriter api
🚧 This is slightly WIP.
Revamps StreamWriter.
Motivation:
There are two issues with current StreamWriter API:
- no access to allocator
- writer completion is super confusing, it will be considered finished when the returned
EventLoopFutureis completed, which is not ideal.
Modifications:
- Deprecate old
StreamWriterAPI - Introduce new type
StreamWriter2(really need help with the naming here) with the following API:
let body: HTTPClient.Body = .stream2(length: 8) { writer in
writer.write(writer.allocator.buffer(string: "1234").whenComplete { _ in
writer.write(writer.allocator.buffer(string: "1234").whenComplete { _ in
writer.end()
}
}
}
Result: Closes #194 Closes #264
Just as a heads up, the main development branch has been changed to main, following the Swift policy on this.
This PR has been re-targeted to main and should just work. However when performing rebases etc please keep this in mind -- you may want to fetch the main branch and rebase onto the main branch from now on since master is not up-to-date anymore and is going to be deleted shortly.