Method: Webbed::Request#initialize

Defined in:
lib/webbed/request.rb

#initialize(method, request_uri, headers, entity_body, options = {}) ⇒ Request

Creates a new Request.

The method converts the values passed in to their proper types.

Examples:

Webbed::Request.new('GET', 'http://example.com', {}, '')

Parameters:

  • method (Method, String)
  • request_uri (Addressable::URI, String)
  • headers (Headers, Hash)
  • entity_body (#to_s)
  • options (Array) (defaults to: {})

    the options to create the Request with

Options Hash (options):

  • :http_version (#to_s) — default: 1.1

    the HTTP-Version of the Request

  • :scheme ('http', 'https') — default: 'http'

    the scheme of the Request



45
46
47
48
49
50
51
52
# File 'lib/webbed/request.rb', line 45

def initialize(method, request_uri, headers, entity_body, options = {})
  self.method       = method
  self.request_uri  = request_uri
  self.headers      = headers
  self.entity_body  = entity_body
  self.http_version = options[:http_version] || 1.1
  self.scheme       = options[:scheme] || 'http'
end