Class: OneApm::Support::HTTPClients::HTTPClientRequest
- Inherits:
-
Object
- Object
- OneApm::Support::HTTPClients::HTTPClientRequest
- Defined in:
- lib/one_apm/support/http_clients/httpclient_wrappers.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #body ⇒ Object
- #host ⇒ Object
-
#initialize(request) ⇒ HTTPClientRequest
constructor
A new instance of HTTPClientRequest.
- #method ⇒ Object
- #params ⇒ Object
- #port ⇒ Object
- #post_params ⇒ Object
- #query ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(request) ⇒ HTTPClientRequest
Returns a new instance of HTTPClientRequest.
30 31 32 33 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 30 def initialize(request) @request = request @uri = request.header.request_uri end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
28 29 30 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 28 def request @request end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
28 29 30 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 28 def uri @uri end |
Instance Method Details
#[](key) ⇒ Object
55 56 57 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 55 def [](key) request.headers[key] end |
#[]=(key, value) ⇒ Object
59 60 61 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 59 def []=(key, value) request.http_header[key] = value end |
#body ⇒ Object
67 68 69 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 67 def body request.http_body.instance_values['body'] end |
#host ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 43 def host if hostname = (self['host'] || self['Host']) hostname.split(':').first else uri.host.to_s end end |
#method ⇒ Object
39 40 41 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 39 def method request.header.request_method end |
#params ⇒ Object
75 76 77 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 75 def params post_params.merge(query) end |
#port ⇒ Object
51 52 53 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 51 def port uri.port end |
#post_params ⇒ Object
71 72 73 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 71 def post_params body.nil?? {} : CGI.parse(body) end |
#query ⇒ Object
63 64 65 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 63 def query @uri.query.nil?? {} : CGI.parse(@uri.query) end |
#type ⇒ Object
35 36 37 |
# File 'lib/one_apm/support/http_clients/httpclient_wrappers.rb', line 35 def type "HTTPClient" end |