httpoison icon indicating copy to clipboard operation
httpoison copied to clipboard

Feature: Partial request body & Error when limit exceeded

Open pedep opened this issue 7 years ago • 3 comments

From #355 - Continued

I'm sorry, but it seems #354's assumed behaviour was wrong.
I assumed the :max_length in body/2 would error, because, what would an incomplete response be worth, but it seems it simply returns the body up until :max_length.

I have corrected the doc and spec to reflect this.
I will submit another PR implementing this behaviour in HTTPoison, since my original intention was to protect against too much data being returned with an error.

Sorry for the mistake @edgurgel

This PR allows for both partial body reading and error on exceeded limit. The parse_request_body function is mostly based on the :hackney_response.read_body/3 function

I will leave #355 open, since it should be merged regardless, while this could be subject to change, pending CR

pedep avatar Sep 17 '18 14:09 pedep

I will play with this PR later this week. Thanks once again for the contribution!

edgurgel avatar Sep 26 '18 22:09 edgurgel

Lets pause this and see what happens in https://github.com/benoitc/hackney/issues/533

pedep avatar Sep 28 '18 14:09 pedep

@pedep okay! Thank you for pushing this forward to hackney as it seems a more natural place for the feature. Let's see how it goes 👍

edgurgel avatar Sep 29 '18 21:09 edgurgel