diplomat 2.4.2 → 2.4.3

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: 9c7e8a3d9eafc0f8f531682772b965cae7d19fce0e7cfb875b8c28c0cceda992
4
- data.tar.gz: dba720fa8b559c3a7ff1f9456ccf4f97fad2376144fbf4712676a09c6edc4798
3
+ metadata.gz: b571a3aec13d14c2ab39cfd7ab851a3aad28aaa959d291ed03416efda30ded9b
4
+ data.tar.gz: f915b612a7a7f7caf110be521adb3eeca060319ab8291e5329c13b055e7e22f4
5
5
  SHA512:
6
- metadata.gz: 75aed31505c916be58fb45ee7c8c761279d7eb8b24a35819bfdb0a18e5807603d1fecca5dc0dcfadd9bf7d81259164143be09b455774cde3096b42cec2190184
7
- data.tar.gz: 1034365593d00617b244e20cdcc1e7c0718ac488f9ba8b6ec615a0069fa491f1f6e8fb41380fa3f5a38a8d5808408b2cc34f72d2315dfd850315219b34e16567
6
+ metadata.gz: 6049a79b752f39d63da2bf5aa7fa10614b519f7e1cd6d055fe3479a32ecc8ae10e343c56a2b9bd5c51261d617444bd240aac9d644775cec3138bee483d8ccf62
7
+ data.tar.gz: 3bd373b3983469c65c120d2346cf9d74b2ab998e7748fc1e72343d079273d197d164741ae87686efb4f11412ad466a922f46973d16b7f3452f8a3b6460cd84ad
@@ -39,7 +39,7 @@ module Diplomat
39
39
  custom_params = []
40
40
  custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
41
41
  custom_params << ['passing'] if options[:passing]
42
- custom_params << use_named_parameter('tag', options[:tag]) if options[:tag]
42
+ custom_params += [*options[:tag]].map { |value| use_named_parameter('tag', value) } if options[:tag]
43
43
  custom_params << use_named_parameter('near', options[:near]) if options[:near]
44
44
  custom_params << use_named_parameter('node-meta', options[:node_meta]) if options[:node_meta]
45
45
 
@@ -140,6 +140,14 @@ module Diplomat
140
140
  faraday.request :url_encoded
141
141
  faraday.response :raise_error unless raise_error
142
142
 
143
+ # We have to provide a custom params encoder here because Faraday - by default - assumes that
144
+ # list keys have [] as part of their name. This is however does not match the expectation of
145
+ # the Consul API, which assumes the same query param to simply be repeated
146
+ #
147
+ # So faraday reduces this: http://localhost:8500?a=1&a=2 to http://localhost:8500?a=2 unless you
148
+ # explicitly tell it not to.
149
+ faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
150
+
143
151
  faraday.adapter Faraday.default_adapter
144
152
  end
145
153
  end
@@ -17,21 +17,7 @@ module Diplomat
17
17
  custom_params << use_named_parameter('wait', options[:wait]) if options[:wait]
18
18
  custom_params << use_named_parameter('index', options[:index]) if options[:index]
19
19
  custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
20
- if options[:tag]
21
- # tag can be either a String, or an array of strings
22
- # by splatting it is guaranteed to be an array of strings
23
- [*options[:tag]].each do |value|
24
- custom_params << use_named_parameter('tag', value)
25
- end
26
- end
27
-
28
- # We have to provide a custom params encoder here because Faraday - by default - assumes that
29
- # list keys have [] as part of their name. This is however not the case for consul tags, which
30
- # just use repeated occurences of the same key.
31
- #
32
- # So faraday reduces this: http://localhost:8500?a=1&a=2 to http://localhost:8500?a=2 unless you
33
- # explicitly tell it not to.
34
- options[:params_encoder] = Faraday::FlatParamsEncoder
20
+ custom_params += [*options[:tag]].map { |value| use_named_parameter('tag', value) } if options[:tag]
35
21
 
36
22
  ret = send_get_request(@conn, ["/v1/catalog/service/#{key}"], options, custom_params)
37
23
  if meta && ret.headers
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diplomat
4
- VERSION = '2.4.2'
4
+ VERSION = '2.4.3'
5
5
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diplomat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink
8
8
  - Trevor Wood
9
9
  - Pierre Souchay
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-10-19 00:00:00.000000000 Z
13
+ date: 2021-01-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -255,7 +255,7 @@ homepage: https://github.com/WeAreFarmGeek/diplomat
255
255
  licenses:
256
256
  - BSD-3-Clause
257
257
  metadata: {}
258
- post_install_message:
258
+ post_install_message:
259
259
  rdoc_options: []
260
260
  require_paths:
261
261
  - lib
@@ -270,8 +270,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubygems_version: 3.0.8
274
- signing_key:
273
+ rubygems_version: 3.1.2
274
+ signing_key:
275
275
  specification_version: 4
276
276
  summary: Diplomat is a simple wrapper for Consul
277
277
  test_files: []