diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-07-09 15:12:24 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-07-10 11:53:05 -0700 |
commit | a1d7d65f0a21215851e45639ef7d0df35993ecaa (patch) | |
tree | 486dc0377050393c1907460917ac648e0ad6dd0e /actionpack/lib/action_dispatch | |
parent | fabcdc711b582307cb2996d26e82eadf32eb35a1 (diff) | |
download | rails-a1d7d65f0a21215851e45639ef7d0df35993ecaa.tar.gz rails-a1d7d65f0a21215851e45639ef7d0df35993ecaa.tar.bz2 rails-a1d7d65f0a21215851e45639ef7d0df35993ecaa.zip |
drop a conditional by always assigning
We will always make an assignment to the env hash and eliminate a
conditional
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/params_parser.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 3776aa78ed..580fe2964a 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -26,20 +26,19 @@ module ActionDispatch end def call(env) - if params = parse_formatted_parameters(env) - env["action_dispatch.request.request_parameters"] = params - end + default = env["action_dispatch.request.request_parameters"] + env["action_dispatch.request.request_parameters"] = parse_formatted_parameters(env, default) @app.call(env) end private - def parse_formatted_parameters(env) + def parse_formatted_parameters(env, default) request = Request.new(env) - return false if request.content_length.zero? + return default if request.content_length.zero? - strategy = @parsers.fetch(request.content_mime_type) { return false } + strategy = @parsers.fetch(request.content_mime_type) { return default } strategy.call(request.raw_post) |