lib/excon/hypermedia/middleware.rb in excon-hypermedia-0.5.3 vs lib/excon/hypermedia/middleware.rb in excon-hypermedia-0.6.0
- old
+ new
@@ -3,10 +3,18 @@
require 'backport_dig' if RUBY_VERSION < '2.3'
Excon.defaults[:middlewares].delete(Excon::Addressable::Middleware)
Excon.defaults[:middlewares].unshift(Excon::Addressable::Middleware)
+# Excon
+#
+# We inject the `expand` key to the allowed lists of keys to be used when
+# creating a request, or connection object. Excon does not enforce this yet, but
+# it does print a warning, so this makes things future-proof.
module Excon
+ VALID_REQUEST_KEYS.push(:hcp, :embedded, :hypermedia)
+ VALID_CONNECTION_KEYS.push(:hcp, :embedded, :hypermedia)
+
module HyperMedia
# Middleware
#
# This middleware sets the `hypermedia` datum to `true`, if the returned
# `Content-Type` header contains `hal+json`.