Module: Linzer::Faraday::Utils
- Defined in:
- lib/linzer/faraday/utils.rb
Overview
Utility methods for converting Faraday middleware objects into types compatible with Linzer adapters.
Class Method Summary collapse
-
.create_request(env) ⇒ ::Faraday::Request
Creates a Faraday::Request from a middleware environment.
Class Method Details
.create_request(env) ⇒ ::Faraday::Request
Creates a Faraday::Request from a middleware environment.
Builds a minimal request suitable for use with Message::Adapter::Faraday::Request, preserving the original HTTP method, URL, and headers from the environment.
19 20 21 22 23 24 25 26 |
# File 'lib/linzer/faraday/utils.rb', line 19 def self.create_request(env) ::Faraday::Request.create(env.method) do |req| req.params = ::Faraday::Utils::ParamsHash.new req.headers = ::Faraday::Utils::Headers.new(env.request_headers.dup) req. = ::Faraday::ConnectionOptions.from(nil).request req.url env.url end end |