bv-ui-core 2.9.8 → 2.9.9
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.
- package/lib/bvFetch/index.js +11 -4
- package/package.json +1 -1
package/lib/bvFetch/index.js
CHANGED
@@ -69,12 +69,15 @@ module.exports = function BvFetch ({ shouldCache, cacheName, cacheLimit, exclude
|
|
69
69
|
*/
|
70
70
|
this.generateCacheKey = (url, options) => {
|
71
71
|
const filteredOptions = Object.assign({}, options);
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
if (filteredOptions.headers) {
|
73
|
+
const newHeaders = new Headers();
|
74
|
+
for (const [key, value] of Object.entries(filteredOptions.headers)) {
|
75
|
+
if (!this.excludeHeaders.includes(key)) {
|
76
|
+
newHeaders.set(key, value);
|
77
|
+
}
|
75
78
|
}
|
79
|
+
filteredOptions.headers = newHeaders;
|
76
80
|
}
|
77
|
-
);
|
78
81
|
const key = new Request(url, filteredOptions);
|
79
82
|
return key;
|
80
83
|
};
|
@@ -156,6 +159,10 @@ module.exports = function BvFetch ({ shouldCache, cacheName, cacheLimit, exclude
|
|
156
159
|
canBeCached = false;
|
157
160
|
return;
|
158
161
|
}
|
162
|
+
if (!response.headers.has('Cache-Control')) {
|
163
|
+
canBeCached = false;
|
164
|
+
return;
|
165
|
+
}
|
159
166
|
// Check for error in response obj
|
160
167
|
errJson.json().then(json => {
|
161
168
|
if (typeof this.shouldCache === 'function') {
|