File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,12 @@ def delete(key)
7777 super ( key )
7878 end
7979
80+ def dig ( key , *rest )
81+ key = KeyMap [ key ]
82+ key = @names . fetch ( key . downcase , key )
83+ super ( key , *rest )
84+ end
85+
8086 def include? ( key )
8187 @names . include? key . downcase
8288 end
Original file line number Diff line number Diff line change 5656 it { expect ( subject . delete ( 'content-type' ) ) . to be_nil }
5757 end
5858
59+ describe '#dig' do
60+ before { subject [ 'Content-Type' ] = 'application/json' }
61+
62+ it { expect ( subject &.dig ( 'Content-Type' ) ) . to eq ( 'application/json' ) }
63+ it { expect ( subject &.dig ( 'CONTENT-TYPE' ) ) . to eq ( 'application/json' ) }
64+ it { expect ( subject &.dig ( :content_type ) ) . to eq ( 'application/json' ) }
65+ it { expect ( subject &.dig ( 'invalid' ) ) . to be_nil }
66+ end
67+
5968 describe '#parse' do
6069 context 'when response headers leave http status line out' do
6170 let ( :headers ) { "HTTP/1.1 200 OK\r \n Content-Type: text/html\r \n \r \n " }
You can’t perform that action at this time.
0 commit comments