lib/excon/hypermedia/middleware.rb in excon-hypermedia-0.4.0 vs lib/excon/hypermedia/middleware.rb in excon-hypermedia-0.4.1
- old
+ new
@@ -12,13 +12,12 @@
#
# If the `hypermedia` attribute is already set for the connection, it
# will be left alone by this middleware.
#
class Middleware < Excon::Middleware::Base
- def request_call(datum)
+ def response_call(datum)
return super unless (content_type = datum.dig(:response, :headers, 'Content-Type').to_s)
- datum[:response] ||= {}
datum[:response][:hypermedia] = if datum[:hypermedia].nil?
content_type.include?('hal+json')
else
datum[:hypermedia]
end