Skip to content

Commit

Permalink
Only allow ActionableErrors if show_detailed_exceptions is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca authored and tenderlove committed Jun 17, 2020
1 parent d2cdf0b commit 661da26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -23,7 +23,7 @@ def call(env)

private
def actionable_request?(request)
request.show_exceptions? && request.post? && request.path == endpoint
request.get_header("action_dispatch.show_detailed_exceptions") && request.post? && request.path == endpoint
end

def redirect_to(location)
Expand Down
10 changes: 5 additions & 5 deletions actionpack/test/dispatch/actionable_exceptions_test.rb
Expand Up @@ -30,7 +30,7 @@ class ActionError < StandardError
error: ActionError.name,
action: "Successful action",
location: "/",
}
}, headers: { "action_dispatch.show_detailed_exceptions" => true }

assert_equal ["Action!"], Actions

Expand All @@ -43,7 +43,7 @@ class ActionError < StandardError
error: ActionError.name,
action: "Successful action",
location: "/",
}, headers: { "action_dispatch.show_exceptions" => false }
}, headers: { "action_dispatch.show_detailed_exceptions" => false }

assert_empty Actions
end
Expand All @@ -54,7 +54,7 @@ class ActionError < StandardError
error: ActionError.name,
action: "Failed action",
location: "/",
}
}, headers: { "action_dispatch.show_detailed_exceptions" => true }
end
end

Expand All @@ -64,7 +64,7 @@ class ActionError < StandardError
error: RuntimeError.name,
action: "Inexistent action",
location: "/",
}
}, headers: { "action_dispatch.show_detailed_exceptions" => true }
end
end

Expand All @@ -74,7 +74,7 @@ class ActionError < StandardError
error: "",
action: "Inexistent action",
location: "/",
}
}, headers: { "action_dispatch.show_detailed_exceptions" => true }
end
end
end

0 comments on commit 661da26

Please sign in to comment.