spec/faraday/utils/headers_spec.rb in faraday-2.9.0 vs spec/faraday/utils/headers_spec.rb in faraday-2.9.1
- old
+ new
@@ -54,9 +54,18 @@
it { expect(subject.size).to eq(0) }
it { is_expected.not_to include('content-type') }
it { expect(subject.delete('content-type')).to be_nil }
end
+ describe '#dig' do
+ before { subject['Content-Type'] = 'application/json' }
+
+ it { expect(subject&.dig('Content-Type')).to eq('application/json') }
+ it { expect(subject&.dig('CONTENT-TYPE')).to eq('application/json') }
+ it { expect(subject&.dig(:content_type)).to eq('application/json') }
+ it { expect(subject&.dig('invalid')).to be_nil }
+ end
+
describe '#parse' do
context 'when response headers leave http status line out' do
let(:headers) { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" }
before { subject.parse(headers) }