aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2017-03-29 17:36:54 -0400
committerJon Moss <me@jonathanmoss.me>2017-03-29 19:26:39 -0400
commit9d695743dee0eb57cedd1f0e7a9dc1a16ef0b530 (patch)
tree234936a7a79bc683e0a9be881b5ba65fe87d516e /actionpack/lib
parentf77a6be8d23f048ced4fac54f1f4caea5e0749d7 (diff)
downloadrails-9d695743dee0eb57cedd1f0e7a9dc1a16ef0b530.tar.gz
rails-9d695743dee0eb57cedd1f0e7a9dc1a16ef0b530.tar.bz2
rails-9d695743dee0eb57cedd1f0e7a9dc1a16ef0b530.zip
Do not include default response headers for AC::Metal
In Rails 4.2, `ActionController::Metal` controllers did not include the default headers from `ActionDispatch::Response`. However, through e16afe6, and a general shift towards having `ActionController::Metal` objects contain `ActionDispatch::Response` objects (instead of just returning an array of status, headers, and body), this behavior was lost. This PR helps to restore the original behavior by having `ActionController::Metal` controllers generate Response objects without the default headers, while `ActionController::Base` now overrides the factory method to make sure its version does have the default headers.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/base.rb6
-rw-r--r--actionpack/lib/action_controller/metal.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 0fe0853da3..b420e00c78 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -261,6 +261,12 @@ module ActionController
PROTECTED_IVARS
end
+ def self.make_response!(request)
+ ActionDispatch::Response.create.tap do |res|
+ res.request = request
+ end
+ end
+
ActiveSupport.run_load_hooks(:action_controller, self)
end
end
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index 74c4153cd2..246644dcbd 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -129,7 +129,7 @@ module ActionController
end
def self.make_response!(request)
- ActionDispatch::Response.create.tap do |res|
+ ActionDispatch::Response.new.tap do |res|
res.request = request
end
end