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

Feature Request: body/2 error when body exceeds MaxLength #533

Open
pedep opened this issue Sep 17, 2018 · 3 comments
Open

Feature Request: body/2 error when body exceeds MaxLength #533

pedep opened this issue Sep 17, 2018 · 3 comments

Comments

@pedep
Copy link

pedep commented Sep 17, 2018

Currently, when you process a request that exceeds MaxLength, the incomplete result silently returns.
This is not always that helpful, because an impartial result might not be parseable. Since no error gets returned by hackney, its not possible to distinguish between malformed responses and excessively large responses that have been cropped.

I am using hackney through HTTPoison, and would like to support this behaviour.
Would this use-case fit hackney, or am i better off submitting a PR downstream in HTTPoison?

@benoitc
Copy link
Owner

benoitc commented Sep 28, 2018

should be in hackney. I guess returning {error, {partial_body, Body}} or similar would do the trick

@pedep
Copy link
Author

pedep commented Sep 28, 2018

Alright! :)
I toyed around with the idea downstream, and it seems to work fine (edgurgel/httpoison#356)

Are you okay with changing the default behavior, or would it be better to provide a new function/an option?

I wouldn't mind writing a quick PR, but I'm not quite confident enough in my Erlang to guarantee anything good

@benoitc
Copy link
Owner

benoitc commented Sep 28, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants