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
Return {error, max_length} instead of exception in cowboy_req:body/2 #290
Comments
seconded |
Just wondering why you would have a |
take a look at #309 |
No answers there. |
I'm sorry to say that I'm thinking of removing this function entirely. It's just too unsafe. Me and @dvv agree it's best handled in your own code, where you can choose to throw, or to handle it, by calling stream_body directly, and looping similarly to this. Problem is that Cowboy here has no way of doing it without introducing risks that you might end up with the wrong state depending on what you are doing with it. I prefer removing and perhaps providing an example later on instead. |
Removed in 2690d12. Thanks! |
When the request max length is larger than the limit, cowboy throws an exception error:function_clause.
Wouldn't it be better to catch this case and return {error, max_length} or something similar?
https://github.com/extend/cowboy/blob/master/src/cowboy_req.erl#L705
The text was updated successfully, but these errors were encountered: