logstash-filter-http 1.2.0 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 676e5abcdac3f6a16a8274eb18793cd7d75fe26545f7b2bfee9f707b6cf1fb90
4
- data.tar.gz: 3ed6f080ba7323a07621cc69380f693a07b51ab5b374d0172d660a8682396f90
3
+ metadata.gz: 9cc14c2d1874c8df2c795535e90ee6b7e85070d601039ab0a8f5c91da874af16
4
+ data.tar.gz: 21c3aa078560f4900fb8db35eca35abb60b71798a224164f2a41cd4682e2f755
5
5
  SHA512:
6
- metadata.gz: 76adf00a0498d9f2f1d43b898457d744dce0a8ecef5bc15b559682513e2fc3cf09747925dea0a01b515762cbba9f9e5106ee316ea7c44a420a13b67596c24656
7
- data.tar.gz: ceeaadb9afcc5678f87f7b1d3ccf6446d56826db73354655bc5f4976d0bf07698bc061db234fd27cf569de9fd1b467dbb6a75c918a04929918235ef42a08869e
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 body_format == "json"
63
- headers_sprintfed["content-type"] = "application/json"
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.2.0'
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 'logstash-mixin-http_client', '>= 5.0.0', '< 9.0.0'
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'
@@ -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.2.0
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: 2021-12-06 00:00:00.000000000 Z
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: 5.0.0
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: 5.0.0
63
+ version: 7.2.0
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
66
  version: 9.0.0