lib/excon/hypermedia/middleware.rb in excon-hypermedia-0.3.0 vs lib/excon/hypermedia/middleware.rb in excon-hypermedia-0.4.0

- old
+ new

@@ -1,7 +1,8 @@ # frozen_string_literal: true +Excon.defaults[:middlewares].delete(Excon::Addressable::Middleware) Excon.defaults[:middlewares].unshift(Excon::Addressable::Middleware) module Excon module HyperMedia # Middleware @@ -14,9 +15,10 @@ # class Middleware < Excon::Middleware::Base def request_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