Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case Insensitivity Issue with #dig Method on Response Headers #1556

Closed
vitali-semenyuk opened this issue Apr 1, 2024 · 1 comment · Fixed by #1557
Closed

Case Insensitivity Issue with #dig Method on Response Headers #1556

vitali-semenyuk opened this issue Apr 1, 2024 · 1 comment · Fixed by #1557

Comments

@vitali-semenyuk
Copy link
Contributor

Basic Info

  • Faraday Version: 2.9.0
  • Ruby Version: 3.1.2

Issue description

I've encountered an issue with the case-insensitive Hash which is used as a response headers container. While the case insensitivity works as expected when accessing headers using #[], it fails when using the #dig method. Rack handles this properly: https://github.com/rack/rack/blob/8c73aefcc7085c71bdfe6c1ec867f126ede34124/lib/rack/headers.rb#L131-L133

Steps to reproduce

require 'faraday'

response = Faraday.get('http://httpbingo.org')

pp response.headers.dig('via') # "1.1 fly.io"
pp response.headers.dig('Via') # nil
@olleolleolle
Copy link
Member

Cool find, would you like to try making a PR?

Can it be done without changing all adapters? Probably!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants