logstash-mixin-event_support 1.0.0-java → 1.0.1-java
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87434fe9c24b251c2f6cd6af4bc84f0b47ccfb91ffd1cf2093e4cc0fc6896b95
|
4
|
+
data.tar.gz: 1be7ae7534554116bf16693742c46fe82a0aed6c51ea6b6063fc92852955567e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96cbab56e967042496b0459443b9260f5380bf9cc6e213afc868c37eb282e60176100e848138b13e3504c9197fcbe9badc183b065e8170ea60026b454b937d6c
|
7
|
+
data.tar.gz: fd2c3758b5b960c21d6b019a07999cd93e8ec8e43dbd500111f14c54b37725504eb2936568be91988ce9529d7bfba4ec085f3ad9e4843d4e28c70cbc18c3795b
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,5 @@
|
|
1
|
+
## 1.0.1
|
2
|
+
- Fix: compatibility when parsing blank JSON [#3](https://github.com/logstash-plugins/logstash-mixin-event_support/pull/3)
|
3
|
+
|
4
|
+
## 1.0.0
|
5
|
+
- Feat: event factory support + from_json helper [#2](https://github.com/logstash-plugins/logstash-mixin-event_support/pull/2)
|
@@ -36,6 +36,7 @@ module LogStash
|
|
36
36
|
case decoded
|
37
37
|
when Array then decoded.map { |data| event_factory.new_event(data) }
|
38
38
|
when Hash then [ event_factory.new_event(decoded) ]
|
39
|
+
when nil then [] # same behavior as Event.from_json("")
|
39
40
|
else raise LogStash::Json::ParserError.new("JSON must contain array or hash, got #{decoded.class}")
|
40
41
|
end
|
41
42
|
end
|
@@ -51,6 +51,15 @@ describe LogStash::PluginMixins::EventSupport::FromJsonHelper do
|
|
51
51
|
expect( events[1].get('[test]') ).to eql 'baz' => 42.0
|
52
52
|
end
|
53
53
|
|
54
|
+
it 'does not raise on blank strings' do
|
55
|
+
events = plugin.events_from_json('', event_factory)
|
56
|
+
expect( events.size ).to eql 0
|
57
|
+
events = plugin.events_from_json(" ", event_factory)
|
58
|
+
expect( events.size ).to eql 0
|
59
|
+
events = plugin.events_from_json("\n", event_factory)
|
60
|
+
expect( events.size ).to eql 0
|
61
|
+
end
|
62
|
+
|
54
63
|
it 'raises on unexpected json' do
|
55
64
|
expect { plugin.events_from_json(' "42" ', event_factory) }.to raise_error(LogStash::Json::ParserError)
|
56
65
|
end
|