Skip to content

Fix broken release 0.7.0 #9

@sebco

Description

@sebco

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions