DEV: Fix failing spec after Rails upgrade to 7.0.5.1 (#22317)

Follow up to 4d3999de10
This commit is contained in:
Alan Guo Xiang Tan 2023-06-28 08:17:11 +08:00 committed by GitHub
parent cec68b3e2c
commit 68bb53a196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions

View File

@ -49,12 +49,16 @@ module Middleware
# Or badly formatted multipart requests
begin
request.POST
rescue EOFError
return [
400,
{ "Cache-Control" => "private, max-age=0, must-revalidate" },
["Invalid request"]
]
rescue ActionController::BadRequest => error
if error.cause.is_a?(EOFError)
return [
400,
{ "Cache-Control" => "private, max-age=0, must-revalidate" },
["Invalid request"]
]
else
raise
end
end
if ApplicationController.rescue_with_handler(exception, object: fake_controller)