Class: NewRelic::Agent::HTTPClients::TyphoeusHTTPRequest
Constant Summary
collapse
- TYPHOEUS =
'Typhoeus'.freeze
- GET =
'GET'.freeze
AbstractRequest::COLON, AbstractRequest::LHOST, AbstractRequest::UHOST
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TyphoeusHTTPRequest.
37
38
39
40
41
42
43
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 37
def initialize(request)
@request = request
@uri = case request.url
when ::URI then request.url
else NewRelic::Agent::HTTPClients::URIUtil.parse_and_normalize_url(request.url)
end
end
|
Instance Method Details
#[](key) ⇒ Object
65
66
67
68
69
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 65
def [](key)
return nil unless @request.options &&
[key]
end
|
#[]=(key, value) ⇒ Object
71
72
73
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 71
def []=(key, value)
[key] = value
end
|
75
76
77
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 75
def
@request.options[:headers] || {}
end
|
#host ⇒ Object
55
56
57
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 55
def host
|| @uri.host
end
|
51
52
53
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 51
def
self[LHOST] || self[UHOST]
end
|
#method ⇒ Object
61
62
63
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 61
def method
(@request.options[:method] || GET).to_s.upcase
end
|
#type ⇒ Object
47
48
49
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 47
def type
TYPHOEUS
end
|
#uri ⇒ Object
79
80
81
|
# File 'lib/new_relic/agent/http_clients/typhoeus_wrappers.rb', line 79
def uri
@uri
end
|