Sha256: 6d640f611b156ed41078cd3a8c544feb9e188269fa9488244ba64e2035cec7b2

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

module FakeMechanize
  # Request represents a request made to the server with its specific headers and its answer body, headers
  # and status (http code)
  class Request
    attr_reader :method, :uri, :request_headers, :body, :status, :response_headers
    
    def initialize(args = {})
      # Query
      @method           = args[:method] || :get
      @uri              = args[:uri]
      @request_headers  = args[:request_headers] || {}
      
      # Answer
      @body             = args[:body]
      @status           = args[:status] || 200
      @response_headers = args[:response_headers] || {}
    end
    
    # evaluate if <tt>alt</tt> has the same query parameters as the current object.
    # Returns true if equal, false otherwise.
    # Evaluation is based on method, uri and request_headers.
    def ==(alt)
      method == alt.method and uri == alt.uri and request_headers == alt.request_headers
    end
  end # Request
end # FakeMechanize

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fake_mechanize-0.0.1 lib/fake_mechanize/request.rb