logstash-filter-http 1.2.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/logstash/filters/http.rb +2 -4
- data/logstash-filter-http.gemspec +2 -2
- data/spec/filters/http_spec.rb +19 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cc14c2d1874c8df2c795535e90ee6b7e85070d601039ab0a8f5c91da874af16
|
4
|
+
data.tar.gz: 21c3aa078560f4900fb8db35eca35abb60b71798a224164f2a41cd4682e2f755
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba589b66860997ba29e3edaa5564c04d897ed9502fc46b263a356ae80a7c768aa1570873ced5865aa7c66523e1aa04054ef604d61e68e4c3644f548456d82a1
|
7
|
+
data.tar.gz: 8974fa26e8127e6a7a880d44c8df7be1ac4ec4435dc38a6912f589f1d1f7bc4eae2154f8cd2fdb3307a5a67896df2fd95e692460d182f65f5fb69cc12f2b58e1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 1.4.0
|
2
|
+
- Feat: added ssl_supported_protocols option [#38](https://github.com/logstash-plugins/logstash-filter-http/pull/38)
|
3
|
+
|
4
|
+
## 1.3.0
|
5
|
+
- Feat: support ssl_verification_mode option [#37](https://github.com/logstash-plugins/logstash-filter-http/pull/37)
|
6
|
+
|
7
|
+
## 1.2.1
|
8
|
+
- Fix: do not set content-type if provided by user [#36](https://github.com/logstash-plugins/logstash-filter-http/pull/36)
|
9
|
+
|
1
10
|
## 1.2.0
|
2
11
|
- Feat: improve ECS compatibility [#35](https://github.com/logstash-plugins/logstash-filter-http/pull/35)
|
3
12
|
|
@@ -59,10 +59,8 @@ class LogStash::Filters::Http < LogStash::Filters::Base
|
|
59
59
|
def filter(event)
|
60
60
|
url_for_event = event.sprintf(@url)
|
61
61
|
headers_sprintfed = sprintf_object(event, @headers)
|
62
|
-
if
|
63
|
-
headers_sprintfed[
|
64
|
-
else
|
65
|
-
headers_sprintfed["content-type"] = "text/plain"
|
62
|
+
if !headers_sprintfed.key?('content-type') && !headers_sprintfed.key?('Content-Type')
|
63
|
+
headers_sprintfed['content-type'] = @body_format == "json" ? "application/json" : "text/plain"
|
66
64
|
end
|
67
65
|
query_sprintfed = sprintf_object(event, @query)
|
68
66
|
body_sprintfed = sprintf_object(event, @body)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-http'
|
3
|
-
s.version = '1.
|
3
|
+
s.version = '1.4.0'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = 'This filter requests data from a RESTful Web Service.'
|
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 logstash-filter-http. This gem is not a stand-alone program'
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
# Gem dependencies
|
29
29
|
s.add_runtime_dependency 'logstash-core-plugin-api', '>= 1.60', '<= 2.99'
|
30
30
|
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.2'
|
31
|
-
s.add_runtime_dependency
|
31
|
+
s.add_runtime_dependency "logstash-mixin-http_client", ">= 7.2.0", '< 9.0.0'
|
32
32
|
s.add_runtime_dependency 'logstash-mixin-validator_support', '~> 1.0'
|
33
33
|
|
34
34
|
s.add_development_dependency 'logstash-devutils'
|
data/spec/filters/http_spec.rb
CHANGED
@@ -209,12 +209,14 @@ describe LogStash::Filters::Http do
|
|
209
209
|
end.and_return(response)
|
210
210
|
subject.filter(event)
|
211
211
|
end
|
212
|
+
|
212
213
|
it "sets content-type to application/json" do
|
213
214
|
expect(subject).to receive(:request_http) do |verb, url, options|
|
214
215
|
expect(options).to include(:headers => { "content-type" => "application/json"})
|
215
216
|
end.and_return(response)
|
216
217
|
subject.filter(event)
|
217
218
|
end
|
219
|
+
|
218
220
|
end
|
219
221
|
context "when is text" do
|
220
222
|
let(:body_format) { "text" }
|
@@ -226,12 +228,29 @@ describe LogStash::Filters::Http do
|
|
226
228
|
end.and_return(response)
|
227
229
|
subject.filter(event)
|
228
230
|
end
|
231
|
+
|
229
232
|
it "sets content-type to text/plain" do
|
230
233
|
expect(subject).to receive(:request_http) do |verb, url, options|
|
231
234
|
expect(options).to include(:headers => { "content-type" => "text/plain"})
|
232
235
|
end.and_return(response)
|
233
236
|
subject.filter(event)
|
234
237
|
end
|
238
|
+
|
239
|
+
context 'content-type header present' do
|
240
|
+
|
241
|
+
let(:config) { super().merge 'headers' => { 'X-UA' => 'FOO', 'Content-Type' => 'application/x-www-form-urlencoded' } }
|
242
|
+
|
243
|
+
it "respects set header and does not add another" do
|
244
|
+
expect(subject).to receive(:request_http) do |verb, url, options|
|
245
|
+
headers = options[:headers]
|
246
|
+
expect(headers).to include("Content-Type" => "application/x-www-form-urlencoded")
|
247
|
+
expect(headers).to_not include("content-type")
|
248
|
+
end.and_return(response)
|
249
|
+
subject.filter(event)
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
|
235
254
|
end
|
236
255
|
end
|
237
256
|
context "when using field references" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
requirements:
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 7.2.0
|
53
53
|
- - "<"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 9.0.0
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: 7.2.0
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 9.0.0
|