faraday-http-cache 2.4.0 → 2.4.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f9734c5eda496aee6fc6d189e27f9e39b43600ffb467976649ad3f7046a8efc
|
|
4
|
+
data.tar.gz: 1a4d2d137c3ec0a97790cc4b5bcb706f7e0c2af0d0700e0ae03dfc79f5e2bdba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f93240786d8c3b8012cce14545e2f0f34f1bb12811da4edc549ad145284712b59380dac02f91ed6170d19af7af220e48d905a31a1159129d2b32b45799251df6
|
|
7
|
+
data.tar.gz: 8b2480bebc178003743ca2e0535966ad617349ef7ead2f7b5907f00d4580ba990332472d2ac393dc6b5bd79b787d8d560e5d772f9bfc1faca76ac6b34a5061d7
|
|
@@ -77,7 +77,7 @@ module Faraday
|
|
|
77
77
|
# @return [String]
|
|
78
78
|
def response_cache_key_for(request, vary)
|
|
79
79
|
method = request.method.to_s
|
|
80
|
-
headers = vary.split(/[\s,]+/).map { |header| request.headers[header] }
|
|
80
|
+
headers = vary.split(/[\s,]+/).uniq.sort.map { |header| request.headers[header] }
|
|
81
81
|
Digest::SHA1.hexdigest("by_vary#{@cache_salt}#{method}#{request.url}#{headers.join}")
|
|
82
82
|
end
|
|
83
83
|
end
|
|
@@ -4,10 +4,11 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe Faraday::HttpCache::Strategies::ByVary do
|
|
6
6
|
let(:vary_index_cache_key) { '64896419583e8022efeb21d0ece6e266c0e58b59' }
|
|
7
|
-
let(:cache_key) { '
|
|
8
|
-
let(:vary) { '' }
|
|
7
|
+
let(:cache_key) { '978047698d156fe8642a86dbfaacc675917c9a22' }
|
|
8
|
+
let(:vary) { 'Accept, Accept-Encoding, X-Requested-With' }
|
|
9
|
+
let(:headers) { {'Accept' => 'text/html', 'Accept-Encoding' => 'gzip, deflate, br' } }
|
|
9
10
|
let(:request) do
|
|
10
|
-
env = {method: :get, url: 'http://test/index'}
|
|
11
|
+
env = {method: :get, url: 'http://test/index', headers: headers}
|
|
11
12
|
double(env.merge(serializable_hash: env))
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -54,11 +55,17 @@ describe Faraday::HttpCache::Strategies::ByVary do
|
|
|
54
55
|
)
|
|
55
56
|
end
|
|
56
57
|
end
|
|
58
|
+
|
|
59
|
+
context 'with reordered and doubled values in the vary' do
|
|
60
|
+
let(:vary) { 'X-Requested-With,Accept,Accept-Encoding,Accept' }
|
|
61
|
+
|
|
62
|
+
it_behaves_like 'A strategy with serialization'
|
|
63
|
+
end
|
|
57
64
|
end
|
|
58
65
|
|
|
59
66
|
context 'with the Marshal serializer' do
|
|
60
67
|
let(:vary_index_cache_key) { '6a7cb42440c10ef6edeb1826086a4d90b04103f0' }
|
|
61
|
-
let(:cache_key) { '
|
|
68
|
+
let(:cache_key) { 'c9edbf280da95d4cac5acda8b8109c0aba2a469a' }
|
|
62
69
|
let(:serializer) { Marshal }
|
|
63
70
|
let(:strategy) { described_class.new(store: cache, serializer: Marshal) }
|
|
64
71
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: faraday-http-cache
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lucas Mazza
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2022-
|
|
13
|
+
date: 2022-08-08 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: faraday
|