diff options
author | Neil Lathwood <neil@lathwood.co.uk> | 2017-10-31 21:38:54 +0000 |
---|---|---|
committer | laf <neil@lathwood.co.uk> | 2017-11-10 13:06:40 +0000 |
commit | d156ac397beffabe3f0cb045f923050a3ab74887 (patch) | |
tree | 0ba404a38da0bca728ba6340303973c201d55ee4 /lib/oxidized/source | |
parent | f720682514df9f49d35e6ced8af41e5dc789f8e0 (diff) |
Added support for sending single node request to http source
Diffstat (limited to 'lib/oxidized/source')
-rw-r--r-- | lib/oxidized/source/http.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/oxidized/source/http.rb b/lib/oxidized/source/http.rb index 6c12f29..e4cb58e 100644 --- a/lib/oxidized/source/http.rb +++ b/lib/oxidized/source/http.rb @@ -15,7 +15,7 @@ class HTTP < Source require "uri" require "json" - def load + def load node=nil nodes = [] uri = URI.parse(@cfg.url) http = Net::HTTP.new(uri.host, uri.port) @@ -28,7 +28,11 @@ class HTTP < Source headers[header] = value end - request = Net::HTTP::Get.new(uri.request_uri, headers) + req_uri = uri.request_uri + if node + req_uri = "#{req_uri}/#{node}" + end + request = Net::HTTP::Get.new(req_uri, headers) if (@cfg.user? && @cfg.pass?) request.basic_auth(@cfg.user,@cfg.pass) end |