aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-06-19 21:44:23 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-10-10 01:35:59 -0300
commita3ff9db69c79e559122c55791dda1e89e6c8d8f4 (patch)
treed37b546a26f25796962f747612d0d4e86ad4d453 /actionpack
parent1b975e6a696655f476b10a4567b537cc92077563 (diff)
downloadrails-a3ff9db69c79e559122c55791dda1e89e6c8d8f4.tar.gz
rails-a3ff9db69c79e559122c55791dda1e89e6c8d8f4.tar.bz2
rails-a3ff9db69c79e559122c55791dda1e89e6c8d8f4.zip
Remove deprecated `cache_control` argument from `ActionDispatch::Static#initialize`
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md4
-rw-r--r--actionpack/lib/action_dispatch/middleware/static.rb9
-rw-r--r--actionpack/test/dispatch/static_test.rb10
3 files changed, 5 insertions, 18 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index edb43172f6..44333b3432 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Remove deprecated `cache_control` argument from `ActionDispatch::Static#initialize`.
+
+ *Rafael Mendonça França*
+
* Remove deprecated support to passing strings or symbols to the middleware stack.
*Rafael Mendonça França*
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb
index fbf2a5fd0b..5c71f0fc48 100644
--- a/actionpack/lib/action_dispatch/middleware/static.rb
+++ b/actionpack/lib/action_dispatch/middleware/static.rb
@@ -106,14 +106,7 @@ module ActionDispatch
# produce a directory traversal using this middleware. Only 'GET' and 'HEAD'
# requests will result in a file being returned.
class Static
- def initialize(app, path, deprecated_cache_control = :not_set, index: "index", headers: {})
- if deprecated_cache_control != :not_set
- ActiveSupport::Deprecation.warn("The `cache_control` argument is deprecated," \
- "replaced by `headers: { 'Cache-Control' => #{deprecated_cache_control} }`, " \
- " and will be removed in Rails 5.1.")
- headers["Cache-Control".freeze] = deprecated_cache_control
- end
-
+ def initialize(app, path, index: "index", headers: {})
@app = app
@file_handler = FileHandler.new(path, index: index, headers: headers)
end
diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb
index f72823a80e..aca70e180c 100644
--- a/actionpack/test/dispatch/static_test.rb
+++ b/actionpack/test/dispatch/static_test.rb
@@ -44,16 +44,6 @@ module StaticTests
assert_equal "Hello, World!", get("/doorkeeper%00").body
end
- def test_sets_cache_control
- app = assert_deprecated do
- ActionDispatch::Static.new(DummyApp, @root, "public, max-age=60")
- end
- response = Rack::MockRequest.new(app).request("GET", "/index.html")
-
- assert_html "/index.html", response
- assert_equal "public, max-age=60", response.headers["Cache-Control"]
- end
-
def test_serves_static_index_at_root
assert_html "/index.html", get("/index.html")
assert_html "/index.html", get("/index")