Use bytes::Bytes as the HTTP request body in HttpClient. #2485
+28
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This will allow pooling of buffers on caller side compared to usage of Vec.
Fixes
Lack of possibility to reuse buffers which are consumed by
HttpClient
after request has been sent.Design discussion issue
Should old function be kept with deprecated annotation and hence new function had to have a different name or should I just introduce breaking change by changing signature of a function?
Changes
I propose to change type of body of http request accepted by
HttpClient
trait fromVec<u8>
tobytes::Bytes
.This should unblock pooling of buffers which can be used both for serialization & being http request bodies.
Something like this (pseudo-code to get the idea):
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes