diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-25 18:35:44 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-25 18:35:44 -0700 |
commit | 51c7ac142d31095d4c699f44cc44ddea627da1eb (patch) | |
tree | 920c40c749272ebec57be8b26164829660781dff /actionpack/lib/action_controller/metal/head.rb | |
parent | 85a78d9358aa728298cd020cdc842b55c16f9549 (diff) | |
download | rails-51c7ac142d31095d4c699f44cc44ddea627da1eb.tar.gz rails-51c7ac142d31095d4c699f44cc44ddea627da1eb.tar.bz2 rails-51c7ac142d31095d4c699f44cc44ddea627da1eb.zip |
provide a request and response to all controllers
Controllers should always have a request and response when responding.
Since we make this The Rule(tm), then controllers don't need to be
somewhere in limbo between "asking a response object for a rack
response" or "I, myself contain a rack response". This duality leads to
conditionals spread through the codebase that we can delete:
* https://github.com/rails/rails/blob/85a78d9358aa728298cd020cdc842b55c16f9549/actionpack/lib/action_controller/metal.rb#L221-L223
Diffstat (limited to 'actionpack/lib/action_controller/metal/head.rb')
-rw-r--r-- | actionpack/lib/action_controller/metal/head.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb index 056962b38c..7dbd5ef328 100644 --- a/actionpack/lib/action_controller/metal/head.rb +++ b/actionpack/lib/action_controller/metal/head.rb @@ -36,6 +36,8 @@ module ActionController headers[key.to_s.dasherize.split('-').each { |v| v[0] = v[0].chr.upcase }.join('-')] = value.to_s end + response.status = Rack::Utils.status_code(status) + self.status = status self.location = url_for(location) if location @@ -44,9 +46,6 @@ module ActionController if include_content?(self.response_code) self.content_type = content_type || (Mime[formats.first] if formats) self.response.charset = false if self.response - else - headers.delete('Content-Type') - headers.delete('Content-Length') end true |