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: 233ecb7e5843d824206f80593bbf24a22e21a8d5975eef777db50b3ebfddc498
4
- data.tar.gz: 932f4b6b548e0e60e2fa73afcf9997f1dba7670444cbd7f25b05917ca6798fa8
3
+ metadata.gz: 87434fe9c24b251c2f6cd6af4bc84f0b47ccfb91ffd1cf2093e4cc0fc6896b95
4
+ data.tar.gz: 1be7ae7534554116bf16693742c46fe82a0aed6c51ea6b6063fc92852955567e
5
5
  SHA512:
6
- metadata.gz: a4656f34606801300aad4e2b28c57c1765c841dd93b896402e5dc423007801f9725a520a1bce4d90a8c43b1a4b5cd0aa33c72d7304a9f8a5140e96d3f8201e9e
7
- data.tar.gz: 8fbae0b280cd5913e9316e4bbf0f90301f808666c3b44dc373d972e1d66d3b0f08e3ede83856c166ecc14b8e95094e57d49adece3e56cf96c7c30def745260b8
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-mixin-event_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic