-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle Rack errors when too many files are uploaded (#2256)
* Capture Rack's "too many multipart files" error with a spec * Create a custom error class to handle Rack's multipart error * fixup! Capture Rack's "too many multipart files" error with a spec * Use our custom error class when Rack raises a multipart limit error * Use a Payload Too Large status code for TooManyMultipartFiles errors * Restore Rack's multipart limit after testing the failure * Upadate CHANGELOG * Reword CHANGELOG entry for MultipartPartLimitError change * Backticks around classname in CHANGELOG * Change next version of Grape from 1.6.3 to 1.7.0 The introduction of the TooManyMultipartFiles changes API behavior, so bump the minor version. * Include the system's configured multipart file limit in the error message The number of allowed multipart files is a configurable value in Rack, pull that limit and include it in the generated error message. * Add a note to UPGRADING about the new TooManyMultipartFiles exception
- Loading branch information
Showing
9 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Grape | ||
module Exceptions | ||
class TooManyMultipartFiles < Base | ||
def initialize(limit) | ||
super(message: compose_message(:too_many_multipart_files, limit: limit), status: 413) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
module Grape | ||
# The current version of Grape. | ||
VERSION = '1.6.3' | ||
VERSION = '1.7.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters