fix: expose hackney:body/1,2 and stream_body/1 (#849)#853
Merged
Conversation
The migration guide and examples tell users to read the response body with hackney:body/1 after start_response/1 in streaming body mode, but the functions were not exported from the hackney module, so there was no public way to read the response after a streamed request. Re-export body/1, body/2 and stream_body/1 as thin wrappers over hackney_conn. Also fix the docs: GETTING_STARTED showed reading a regular GET body via body/Ref (the body is returned directly in 4.x) and referenced the removed with_body option; the migration summary called body/stream_body removed when they are still used after start_response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #849.
The migration guide (streaming request body section) and the examples tell users to read the response body with
hackney:body/1afterstart_response/1, butbody/1,body/2andstream_body/1were not exported from thehackneymodule. After a streamed request body there was no public way to read the response.Re-exposes
hackney:body/1,hackney:body/2andhackney:stream_body/1as thin wrappers over the existinghackney_connfunctions (already used internally by the sync path).Docs fixed too:
GETTING_STARTED.mdshowed reading a regular GET body viahackney:body(Ref)and referenced the removedwith_bodyoption; in 4.x the body is returned directly in the response tuple.body/stream_bodyremoved, while its own streaming section uses them afterstart_response/1.README.mdstreaming example now shows reading the response withhackney:body/1.Adds an integration test that streams a request body and reads the response with
hackney:body/1.