Method: Hyperclient::EntryPoint#default_faraday_block
- Defined in:
- lib/hyperclient/entry_point.rb
#default_faraday_block ⇒ Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a block to initialize the Faraday connection. The default block includes a middleware to encode requests as JSON, a response middleware to parse JSON responses and sets the adapter as NetHttp.
These middleware can always be changed by accessing the Faraday connection.
135 136 137 138 139 140 141 142 143 144 |
# File 'lib/hyperclient/entry_point.rb', line 135 def default_faraday_block lambda do |connection| connection.use Faraday::Response::RaiseError connection.use FaradayMiddleware::FollowRedirects connection.request :hal_json connection.response :hal_json, content_type: /\bjson$/ connection.adapter :net_http connection..params_encoder = Faraday::FlatParamsEncoder end end |