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

Fix broken release 0.7.0 #9

Open
sebco opened this issue May 11, 2021 · 0 comments
Open

Fix broken release 0.7.0 #9

sebco opened this issue May 11, 2021 · 0 comments

Comments

@sebco
Copy link

sebco commented May 11, 2021

Release 0.7.0 has a bug which appears when trying to access resource (eg here: @subscription_response.resource) at one point when response headers are nil here.

NoMethodError:
  undefined method `resource' for #<Excon::Response:0x00007ff9a82d1898>
  Did you mean?  rescue
# .../gems/ruby-2.7.2/gems/excon-hypermedia-0.6.0/lib/excon/hypermedia/ext/response.rb:15:in `method_missing'

To reproduce the bug in release 0.6.0 you just have to change in here
From:
return super unless (content_type = datum.dig(:response, :headers, 'Content-Type').to_s)
To:
return super unless (content_type = datum.dig(:response, :headers, 'Content-Type').presence)

Indeed in the 0.6.0 realease even if the 'Content-Type' is nil it'll be transformed to_s and the unless condition will never be trigered so technically this issue should have been handled in the 0.6.0 release.

A possible fix might require a deeper analysis (and unit tests) but regarding the time it would involve I think it's not our priority, what do you think @oscaredel ?

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

No branches or pull requests

1 participant