Class: HTTPcap::Request

Inherits:
Message show all
Defined in:
lib/httpcap/request.rb

Overview

Request

Instance Attribute Summary collapse

Attributes inherited from Message

#body, #headers

Instance Method Summary collapse

Methods inherited from Message

#on_body, #on_header_field, #on_header_value, #on_headers_complete, #receive_data

Constructor Details

#initialize(data) ⇒ Request

Returns a new instance of Request.



10
11
12
13
14
15
# File 'lib/httpcap/request.rb', line 10

def initialize(data)
  @http_method = ''
  @relative_url = ''

  super(HTTP::Parser::TYPE_REQUEST, data)
end

Instance Attribute Details

#http_methodObject (readonly)

Returns the value of attribute http_method.



8
9
10
# File 'lib/httpcap/request.rb', line 8

def http_method
  @http_method
end

Instance Method Details

#on_message_completeObject



25
26
27
# File 'lib/httpcap/request.rb', line 25

def on_message_complete
  @http_method = @parser.http_method
end

#on_url(url) ⇒ Object



21
22
23
# File 'lib/httpcap/request.rb', line 21

def on_url(url)
  @relative_url = url
end

#urlObject



17
18
19
# File 'lib/httpcap/request.rb', line 17

def url
  @headers.fetch('Host', '') + @relative_url
end