Class: Faraday::Request::UrlEncoded

### Home Classes Methods

### In Files

- lib/faraday/request/url_encoded.rb

### Parent

Faraday::Middleware

### Methods

- #call
- #match_content_type
- #process_request?
- #request_type

### 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::Request::UrlEncoded

### Constants

CONTENT_TYPE

### Attributes

mime_type[RW]

### Public Instance Methods

call(env) click to toggle source

    # File lib/faraday/request/url_encoded.rb, line 10
    def call(env)
      match_content_type(env) do |data|
        env[:body] = Faraday::Utils.build_nested_query data
      end
      @app.call env
    end

match_content_type(env) click to toggle source

    # File lib/faraday/request/url_encoded.rb, line 17
    def match_content_type(env)
      if process_request?(env)
        env[:request_headers][CONTENT_TYPE] ||= self.class.mime_type
        yield env[:body] unless env[:body].respond_to?(:to_str)
      end
    end

process_request?(env) click to toggle source

    # File lib/faraday/request/url_encoded.rb, line 24
    def process_request?(env)
      type = request_type(env)
      env[:body] and (type.empty? or type == self.class.mime_type)
    end

request_type(env) click to toggle source

    # File lib/faraday/request/url_encoded.rb, line 29
    def request_type(env)
      type = env[:request_headers][CONTENT_TYPE].to_s
      type = type.split(';', 2).first if type.index(';')
      type
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.