Module: HTTPX::Plugins::ResponseCache::InstanceMethods
- Defined in:
- lib/httpx/plugins/response_cache.rb,
sig/plugins/response_cache.rbs
Instance Method Summary collapse
-
#match_by_vary?(request, cached_response) ⇒ Boolean
whether the
cached_responsecomplies with the directives set by therequest"vary" header (true when none is available).
Instance Method Details
#match_by_vary?(request, cached_response) ⇒ Boolean
whether the cached_response complies with the directives set by the request "vary" header
(true when none is available).
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/httpx/plugins/response_cache.rb', line 125 def match_by_vary?(request, cached_response) vary = cached_response.vary return true unless vary original_request = cached_response.original_request if vary == %w[*] request..supported_vary_headers.each do |field| return false unless request.headers[field] == original_request.headers[field] end return true end vary.all? do |field| !original_request.headers.key?(field) || request.headers[field] == original_request.headers[field] end end |