Class: HTTPcap::Request
Overview
Request
Instance Attribute Summary collapse
-
#http_method ⇒ Object
readonly
Returns the value of attribute http_method.
Attributes inherited from Message
Instance Method Summary collapse
-
#initialize(data) ⇒ Request
constructor
A new instance of Request.
- #on_message_complete ⇒ Object
- #on_url(url) ⇒ Object
- #url ⇒ Object
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_method ⇒ Object (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_complete ⇒ Object
25 26 27 |
# File 'lib/httpcap/request.rb', line 25 def @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 |
#url ⇒ Object
17 18 19 |
# File 'lib/httpcap/request.rb', line 17 def url @headers.fetch('Host', '') + @relative_url end |