-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Adding a MaximumRequestSizeHandler #1916
Conversation
* Configurable to be on/off. Off by default. * Configurable to set the maximum request size. Default is 1MB. Ref luckyframework#1143
Where should docs for this go? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell, this seems like it's fine. I'm not sure why the specs are failing on it though. As for docs, either at the top of the class file just above the class definition, or we just write them up on the website.
Lucky::MaximumRequestSizeHandler.temp_config(enabled: true) do | ||
run_request_size_handler(context) | ||
end | ||
context.response.status.should eq(HTTP::Status::PAYLOAD_TOO_LARGE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems this failed?
|
||
Habitat.create do | ||
setting enabled : Bool = false | ||
setting max_size : Int32 = 1_048_576 # 1MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually... if you wanted this to be say 10GB (video uploads), would this need to be Int64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the failure is related to changes in ExceptionPage and probably unrelated. The rest looks good! Thanks 🙌
Purpose
A configurable handler for setting a maximum size on requests.
Description
Fixes #1143
Checklist
crystal tool format spec src
./script/setup
./script/test