Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding support for streamed responses #6

Merged
merged 1 commit into from Jul 12, 2021

Conversation

MikeRogers0
Copy link
Collaborator

@MikeRogers0 MikeRogers0 commented Jul 11, 2021

Closes: #5

This adds support for a streamed response and is based on the
implementation I saw https://github.com/lostisland/faraday-net_http/blob/9534fd19bd4898f28361ea60dbc3867edadc15ad/lib/faraday/adapter/net_http.rb#L106-L120

The tests are all passing (Yay), I also ran the steps to reproduce provided by @wconrad (Thank you so much, this helped a bunch) locally & had the result (I also tried a few other links, though I didn't check any massive files):
image

@MikeRogers0 MikeRogers0 marked this pull request as ready for review July 11, 2021 21:09
@MikeRogers0 MikeRogers0 requested a review from iMacTia July 11, 2021 21:09
http_response
else
http.request(env[:url], create_request(env))
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach is based on https://github.com/lostisland/faraday-net_http/blob/9534fd19bd4898f28361ea60dbc3867edadc15ad/lib/faraday/adapter/net_http.rb#L106-L120

Though I'm happy to hear if you think there is a better way :)

@wconrad
Copy link

wconrad commented Jul 12, 2021

My manual tests look good. I tested this feature against a get of a largish (12 MB) file. The size and md5sum were the same for all of these tests run against this feature branch:

  • no persistence, streaming
  • persistence, streaming
  • persistence, not streaming

Copy link
Member

@iMacTia iMacTia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @MikeRogers0 for porting this feature from the net_http adapter and @wconrad for testing with large files as well 🙌
LGTM 🎉 !

@iMacTia iMacTia merged commit 92a676a into main Jul 12, 2021
@iMacTia iMacTia deleted the feature/streaming-response branch July 12, 2021 07:50
@wconrad
Copy link

wconrad commented Jul 12, 2021

You guys are truly awesome. Thanks @iMacTia and @MikeRogers0 !

tisba added a commit to tisba/awesome-faraday that referenced this pull request Sep 15, 2023
olleolleolle pushed a commit to lostisland/awesome-faraday that referenced this pull request Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persistence breaks streaming
3 participants