1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/http/header.rb: pass header names as symbols.

Patch by @DamirSvrtan [fix GH-805]
* test/net/http/test_httpheader.rb: added test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2015-02-08 11:09:44 +00:00
parent 1a18454da9
commit 1a98f56ae1
3 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Sun Feb 8 20:09:37 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/net/http/header.rb: pass header names as symbols.
Patch by @DamirSvrtan [fix GH-805]
* test/net/http/test_httpheader.rb: added test.
Sun Feb 8 13:04:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/socket/getaddrinfo.c (get_addr): reject too long hostname to

View file

@ -169,7 +169,7 @@ module Net::HTTPHeader
alias canonical_each each_capitalized
def capitalize(name)
name.split(/-/).map {|s| s.capitalize }.join('-')
name.to_s.split(/-/).map {|s| s.capitalize }.join('-')
end
private :capitalize

View file

@ -142,6 +142,14 @@ class HTTPHeaderTest < Test::Unit::TestCase
end
end
def test_each_capitalized_with_symbol
@c[:my_header] = ['a', 'b']
@c.each_capitalized do |k,v|
assert_equal "My_header", k
assert_equal 'a, b', v
end
end
def test_key?
@c['My-Header'] = 'test'
assert_equal true, @c.key?('My-Header')