summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--lib/oxidized/source/http.rb3
2 files changed, 5 insertions, 0 deletions
diff --git a/README.md b/README.md
index 07d52eb..3c17dd1 100644
--- a/README.md
+++ b/README.md
@@ -296,6 +296,8 @@ source:
One object per device.
+HTTP Supports basic auth, configure the user and pass you want to use under the http: section.
+
```
source:
default: http
diff --git a/lib/oxidized/source/http.rb b/lib/oxidized/source/http.rb
index 6e765cf..93361a2 100644
--- a/lib/oxidized/source/http.rb
+++ b/lib/oxidized/source/http.rb
@@ -28,6 +28,9 @@ class HTTP < Source
end
request = Net::HTTP::Get.new(uri.request_uri, headers)
+ if (@cfg.user && @cfg.pass)
+ request.basic_auth(@cfg.user,@cfg.pass)
+ end
response = http.request(request)
data = JSON.parse(response.body)