logstash-input-http_poller 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/logstash/inputs/http_poller.rb +10 -2
- data/logstash-input-http_poller.gemspec +1 -1
- data/spec/inputs/http_poller_spec.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3c874545f73eaab85519980784f809bff6d9d38
|
4
|
+
data.tar.gz: 6d10b710df16a97a37f8296ad813afa6d2a95238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d054bd270a593d98a49ac1b16accf096d45319f612c2bfa60ba4d0ff1cbe21d7b800979e87265d509259343db18a76ce66279b24408225c4cf2b1cb1e4243a33
|
7
|
+
data.tar.gz: ae93340bfbd16af78c59de5da8d5f181ab6bbff077ca31daf6dc2f4144e59df1cfb779ee0c35ec596b50e2a7137ab20bd84d012a188bf7abbe0b5ff82402e7b1
|
data/CHANGELOG.md
CHANGED
@@ -240,8 +240,16 @@ class LogStash::Inputs::HTTP_Poller < LogStash::Inputs::Base
|
|
240
240
|
|
241
241
|
private
|
242
242
|
def handle_success(queue, name, request, response, execution_time)
|
243
|
-
|
244
|
-
|
243
|
+
body = response.body
|
244
|
+
# If there is a usable response. HEAD requests are `nil` and empty get
|
245
|
+
# responses come up as "" which will cause the codec to not yield anything
|
246
|
+
if body && body.size > 0
|
247
|
+
@codec.decode(body) do |decoded|
|
248
|
+
event = @target ? LogStash::Event.new(@target => decoded.to_hash) : decoded
|
249
|
+
handle_decoded_event(queue, name, request, response, event, execution_time)
|
250
|
+
end
|
251
|
+
else
|
252
|
+
event = ::LogStash::Event.new
|
245
253
|
handle_decoded_event(queue, name, request, response, event, execution_time)
|
246
254
|
end
|
247
255
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-http_poller'
|
3
|
-
s.version = '3.1.
|
3
|
+
s.version = '3.1.1'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Poll HTTP endpoints with Logstash."
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -398,6 +398,7 @@ describe LogStash::Inputs::HTTP_Poller do
|
|
398
398
|
|
399
399
|
describe "a valid request and decoded response" do
|
400
400
|
let(:payload) { {"a" => 2, "hello" => ["a", "b", "c"]} }
|
401
|
+
let(:response_body) { LogStash::Json.dump(payload) }
|
401
402
|
let(:opts) { default_opts }
|
402
403
|
let(:instance) {
|
403
404
|
klass.new(opts)
|
@@ -414,7 +415,7 @@ describe LogStash::Inputs::HTTP_Poller do
|
|
414
415
|
instance.register
|
415
416
|
u = url.is_a?(Hash) ? url["url"] : url # handle both complex specs and simple string URLs
|
416
417
|
instance.client.stub(u,
|
417
|
-
:body =>
|
418
|
+
:body => response_body,
|
418
419
|
:code => code
|
419
420
|
)
|
420
421
|
allow(instance).to receive(:decorate)
|
@@ -430,6 +431,14 @@ describe LogStash::Inputs::HTTP_Poller do
|
|
430
431
|
end
|
431
432
|
|
432
433
|
include_examples("matching metadata")
|
434
|
+
|
435
|
+
context "with an empty body" do
|
436
|
+
let(:response_body) { "" }
|
437
|
+
it "should return an empty event" do
|
438
|
+
instance.send(:run_once, queue)
|
439
|
+
expect(event.get("[_http_poller_metadata][response_headers][content-length]")).to eql("0")
|
440
|
+
end
|
441
|
+
end
|
433
442
|
|
434
443
|
context "with metadata omitted" do
|
435
444
|
let(:opts) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-http_poller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|