aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_dispatch/http/headers.rb4
-rw-r--r--actionpack/test/dispatch/header_test.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/headers.rb b/actionpack/lib/action_dispatch/http/headers.rb
index 1580241b92..9105da186f 100644
--- a/actionpack/lib/action_dispatch/http/headers.rb
+++ b/actionpack/lib/action_dispatch/http/headers.rb
@@ -17,8 +17,8 @@ module ActionDispatch
def key?(k); @headers.key? k; end
alias :include? :key?
- def fetch(header_name, default=nil, &block)
- @headers.fetch env_name(header_name), default, &block
+ def fetch(header_name, *args, &block)
+ @headers.fetch env_name(header_name), *args, &block
end
def each(&block)
diff --git a/actionpack/test/dispatch/header_test.rb b/actionpack/test/dispatch/header_test.rb
index 4c06200a88..42432510c3 100644
--- a/actionpack/test/dispatch/header_test.rb
+++ b/actionpack/test/dispatch/header_test.rb
@@ -23,6 +23,10 @@ class HeaderTest < ActiveSupport::TestCase
assert @headers.include?('HTTP_CONTENT_TYPE')
end
+ def test_fetch_with_block
+ assert_equal 'omg', @headers.fetch('notthere') { 'omg' }
+ end
+
test "content type" do
assert_equal "text/plain", @headers["Content-Type"]
assert_equal "text/plain", @headers["content-type"]