Class: NewRelic::Agent::HTTPClients::EthonHTTPRequest
Constant Summary
collapse
- DEFAULT_ACTION =
'GET'
- DEFAULT_HOST =
'UNKNOWN_HOST'
- ETHON =
'Ethon'
AbstractRequest::COLON, AbstractRequest::LHOST, AbstractRequest::UHOST
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of EthonHTTPRequest.
46
47
48
49
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 46
def initialize(easy)
@easy = easy
@uri = uri_from_easy
end
|
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
40
41
42
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 40
def uri
@uri
end
|
Instance Method Details
#[](key) ⇒ Object
103
104
105
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 103
def [](key)
[key]
end
|
#[]=(key, value) ⇒ Object
86
87
88
89
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 86
def []=(key, value)
[key] = value
@easy. =
end
|
#action_instance_var ⇒ Object
91
92
93
94
95
96
97
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 91
def
@headers ||= if @easy.instance_variable_defined?()
@easy.instance_variable_get()
else
{}
end
end
|
#host ⇒ Object
72
73
74
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 72
def host
|| uri.host&.downcase || DEFAULT_HOST
end
|
55
56
57
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 55
def
self[LHOST] || self[UHOST]
end
|
#method ⇒ Object
76
77
78
79
80
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 76
def method
return DEFAULT_ACTION unless @easy.instance_variable_defined?(action_instance_var)
@easy.instance_variable_get(action_instance_var)
end
|
#type ⇒ Object
51
52
53
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 51
def type
ETHON
end
|
#uri_from_easy ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/new_relic/agent/http_clients/ethon_wrappers.rb', line 59
def uri_from_easy
url_str = @easy.url.match?(':') ? @easy.url : "http://#{@easy.url}"
begin
URI.parse(url_str)
rescue URI::InvalidURIError => e
NewRelic::Agent.logger.debug("Failed to parse URI '#{url_str}': #{e.class} - #{e.message}")
URI.parse(NewRelic::EMPTY_STR)
end
end
|