class Faraday::Adapter

Constants

CONTENT_LENGTH

Public Instance Methods

call(env) click to toggle source
# File lib/faraday/adapter.rb, line 43
def call(env)
  if !env[:body] and Connection::METHODS_WITH_BODIES.include? env[:method]
    # play nice and indicate we're sending an empty body
    env[:request_headers][CONTENT_LENGTH] = "0"
    # Typhoeus hangs on PUT requests if body is nil
    env[:body] = ''
  end
end
prepend_proxy_auth_string(proxy, session) click to toggle source
# File lib/faraday/adapter/patron.rb, line 61
def prepend_proxy_auth_string(proxy, session)
  session.proxy.insert(7, "#{proxy[:user]}:#{proxy[:password]}@")
end
save_response(env, status, body, headers = nil) { |response_headers| ... } click to toggle source
# File lib/faraday/adapter.rb, line 52
def save_response(env, status, body, headers = nil)
  env[:status] = status
  env[:body] = body
  env[:response_headers] = Utils::Headers.new.tap do |response_headers|
    response_headers.update headers unless headers.nil?
    yield response_headers if block_given?
  end
end