routemaster-drain 3.6.3 → 3.6.4
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +3 -0
- data/lib/routemaster/api_client.rb +2 -2
- data/lib/routemaster/drain.rb +1 -1
- data/spec/routemaster/api_client_spec.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8751ba11d3ecc6376887aca2600adf850839d0ab
|
|
4
|
+
data.tar.gz: 3bcbd8c7cdeefdbe07deb264f196a987e7adeda1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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)
|
data/lib/routemaster/drain.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|