Module: Faraday::Adapter::EMHttp::Options

### Home Classes Methods

### In Files

- lib/faraday/adapter/em_http.rb

### Methods

- #configure_compression
- #configure_proxy
- #configure_timeout
- #connection_config
- #read_body
- #request_config
- #request_options

### Class/Module Index

Quicksearch

- Faraday
- Faraday::Adapter
- Faraday::Adapter::EMHttp
- Faraday::Adapter::EMHttp::Manager
- Faraday::Adapter::EMHttp::Options
- Faraday::Adapter::EMSynchrony
- Faraday::Adapter::EMSynchrony::ParallelManager
- Faraday::Adapter::Excon
- Faraday::Adapter::NetHttp
- Faraday::Adapter::NetHttpPersistent
- Faraday::Adapter::Parallelism
- Faraday::Adapter::Patron
- Faraday::Adapter::Rack
- Faraday::Adapter::Test
- Faraday::Adapter::Test::Stub
- Faraday::Adapter::Test::Stubs
- Faraday::Adapter::Test::Stubs::NotFound
- Faraday::Adapter::Typhoeus
- Faraday::AutoloadHelper
- Faraday::Builder
- Faraday::Builder::Handler
- Faraday::Builder::StackLocked
- Faraday::CompositeReadIO
- Faraday::Connection
- Faraday::Error
- Faraday::Error::ClientError
- Faraday::Error::ConnectionFailed
- Faraday::Error::MissingDependency
- Faraday::Error::ParsingError
- Faraday::Error::ResourceNotFound
- Faraday::Error::TimeoutError
- Faraday::Middleware
- Faraday::MiddlewareRegistry
- Faraday::Request
- Faraday::Request::Authorization
- Faraday::Request::BasicAuthentication
- Faraday::Request::Multipart
- Faraday::Request::Retry
- Faraday::Request::TokenAuthentication
- Faraday::Request::UrlEncoded
- Faraday::Response
- Faraday::Response::Logger
- Faraday::Response::Middleware
- Faraday::Response::RaiseError
- Faraday::Utils
- Faraday::Utils::Headers
- Faraday::Utils::ParamsHash
- Object

No matching classes.

# Faraday::Adapter::EMHttp::Options

### Public Instance Methods

configure_compression(options, env) click to toggle source

    # File lib/faraday/adapter/em_http.rb, line 47
    def configure_compression(options, env)
      if env[:method] == :get and not options[:head].key? 'accept-encoding'
        options[:head]['accept-encoding'] = 'gzip, compressed'
      end
    end

configure_proxy(options, env) click to toggle source

    # File lib/faraday/adapter/em_http.rb, line 31
    def configure_proxy(options, env)
      if proxy = request_options(env)[:proxy]
        options[:proxy] = {
          :host => proxy[:uri].host,
          :port => proxy[:uri].port,
          :authorization => [proxy[:user], proxy[:password]]
        }
      end
    end

configure_timeout(options, env) click to toggle source

    # File lib/faraday/adapter/em_http.rb, line 41
    def configure_timeout(options, env)
      timeout, open_timeout = request_options(env).values_at(:timeout, :open_timeout)
      options[:connect_timeout] = options[:inactivity_timeout] = timeout
      options[:connect_timeout] = open_timeout if open_timeout
    end

connection_config(env) click to toggle source

    # File lib/faraday/adapter/em_http.rb, line 8
    def connection_config(env)
      options = {}
      configure_proxy(options, env)
      configure_timeout(options, env)
      options
    end

read_body(env) click to toggle source

    # File lib/faraday/adapter/em_http.rb, line 26
    def read_body(env)
      body = env[:body]
      body.respond_to?(:read) ? body.read : body
    end

request_config(env) click to toggle source

    # File lib/faraday/adapter/em_http.rb, line 15
    def request_config(env)
      options = {
        :body => read_body(env),
        :head => env[:request_headers],
        # :keepalive => true,
        # :file => 'path/to/file', # stream data off disk
      }
      configure_compression(options, env)
      options
    end

request_options(env) click to toggle source

    # File lib/faraday/adapter/em_http.rb, line 53
    def request_options(env)
      env[:request]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.