routemaster-drain 3.6.3 → 3.6.4

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
  SHA1:
3
- metadata.gz: 68cd91502559ade561ad65e6440cd1609134a380
4
- data.tar.gz: d9c8c31b7d24f5d56f831b49a42bcf1e09c86a43
3
+ metadata.gz: 8751ba11d3ecc6376887aca2600adf850839d0ab
4
+ data.tar.gz: 3bcbd8c7cdeefdbe07deb264f196a987e7adeda1
5
5
  SHA512:
6
- metadata.gz: 9250edbe5107293bab6a4b5ec81eaa61b6e35483223c2af4548b1dce04afc7948c010092fb3dd831b11947ce463700702a1586228f3c110d2c7407bdbb535b4f
7
- data.tar.gz: 8ed05bfc0b1cc2d39353612f18a3f123c13298c222cf77c25ba9873e43eb9f8002091e5eb5a0e8e4f25f4286947b56fa6e36182418fa4e8ad3f9c67a4087126a
6
+ metadata.gz: d30f96275f9ed9785088da2e7d231e7a9f79073bca0f427f796e7a8cc0c42905bd5e1e1d4ef6e97a00f9f665d9433e59d2ee7e04c7e3577a693fb13c4a994cde
7
+ data.tar.gz: e82794bf28ddfc30c60a489020a3d14f652bbbc6e6c476015863cd3a067a6282e9e541dee123e39b159d72296e1d4642a3ef53a74f9cded123d5461676eb9eb0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  _A description of your awesome changes here!_
4
4
 
5
+ ### 3.6.4 (2018-10-23)
6
+
7
+ Features:
8
+
9
+ - Allow specification of User-Agent through environment variable
10
+ - Add fallback values for User-Agent header in API client
11
+
5
12
  ### 3.6.3 (2018-10-17)
6
13
 
7
14
  Bug fix:
data/README.md CHANGED
@@ -264,6 +264,9 @@ configure it using `client_options`:
264
264
  $cache = Routemaster::Cache.new(client_options: {source_peer: "<your user agent>"})
265
265
  ```
266
266
 
267
+ You can specify your user agent with the `ROUTEMASTER_API_CLIENT_USER_AGENT` environment
268
+ variable as well.
269
+
267
270
  ### Expire Cache data for all notified resources
268
271
 
269
272
  You may wish to maintain a coherent cache, but don't need the cache to be warmed
@@ -30,6 +30,7 @@ require 'hashie/mash'
30
30
 
31
31
  module Routemaster
32
32
  class APIClient
33
+ DEFAULT_USER_AGENT = ENV.fetch('ROUTEMASTER_API_CLIENT_USER_AGENT') { "RoutemasterDrain - Faraday v#{Faraday::VERSION}" }.freeze
33
34
 
34
35
  # Memoize the root resources at Class level so that we don't hit the cache
35
36
  # all the time to fetch the root resource before doing anything else.
@@ -157,8 +158,7 @@ module Routemaster
157
158
  end
158
159
 
159
160
  def user_agent_header
160
- agent = @source_peer || "Faraday v#{Faraday::VERSION}"
161
- { 'User-Agent' => agent }
161
+ { 'User-Agent' => @source_peer || DEFAULT_USER_AGENT }
162
162
  end
163
163
 
164
164
  def response_cache_opt_headers(value)
@@ -1,5 +1,5 @@
1
1
  module Routemaster
2
2
  module Drain
3
- VERSION = '3.6.3'.freeze
3
+ VERSION = '3.6.4'.freeze
4
4
  end
5
5
  end
@@ -52,7 +52,8 @@ describe Routemaster::APIClient do
52
52
  headers['x-custom-header'] = 'why do you even'
53
53
  subject.status
54
54
  assert_requested(:get, /example/) do |req|
55
- expect(req.headers).to include('X-Custom-Header')
55
+ expect(req.headers.keys).to include('X-Custom-Header')
56
+ expect(req.headers['User-Agent']).to eql "RoutemasterDrain - Faraday v0.15.3"
56
57
  end
57
58
  end
58
59
 
@@ -76,7 +77,7 @@ describe Routemaster::APIClient do
76
77
  it 'should set the user agent header to the faraday version' do
77
78
  subject.status
78
79
  assert_requested(:get, /example/) do |req|
79
- expect(req.headers).to include('User-Agent' => "Faraday v#{Faraday::VERSION}" )
80
+ expect(req.headers).to include('User-Agent' => "RoutemasterDrain - Faraday v#{Faraday::VERSION}" )
80
81
  end
81
82
  end
82
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routemaster-drain
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.3
4
+ version: 3.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
11
+ date: 2018-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable