Parent

Methods

Included Modules

Mechanize::Chain::RequestResolver

Public Instance Methods

handle(ctx, params) click to toggle source
# File lib/mechanize/chain/request_resolver.rb, line 6
def handle(ctx, params)
  uri = params[:uri]
  if %{ http https }.include?(uri.scheme.downcase)
    klass = Net::HTTP.const_get(params[:verb].to_s.capitalize)
    params[:request] ||= klass.new(uri.request_uri)
    params[:request].body = params[:params].first if params[:params]
  end

  if %{ file }.include?(uri.scheme.downcase)
    o = Struct.new(:uri).new(uri)
    class << o
      def add_field(*args); end
      alias :[]= :add_field
      def path
        uri.path
      end
      def each_header; end
    end
    params[:request] ||= o
  end

  super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.