Class: Excon::HyperMedia::Middleware
- Inherits:
-
Middleware::Base
- Object
- Middleware::Base
- Excon::HyperMedia::Middleware
- Defined in:
- lib/excon/hypermedia/middleware.rb
Overview
Middleware
This middleware sets the hypermedia datum to true, if the returned Content-Type header contains ‘hal+json`.
If the hypermedia attribute is already set for the connection, it will be left alone by this middleware.
Instance Method Summary collapse
Instance Method Details
#request_call(datum) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/excon/hypermedia/middleware.rb', line 16 def request_call(datum) return super unless (content_type = datum.dig(:response, :headers, 'Content-Type').to_s) datum[:response][:hypermedia] = if datum[:hypermedia].nil? content_type.include?('hal+json') else datum[:hypermedia] end super end |