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.
@@ -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
- this.excludeHeaders.forEach(header => {
73
- if (filteredOptions.headers && filteredOptions.headers[header]) {
74
- delete filteredOptions.headers[header];
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') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bv-ui-core",
3
- "version": "2.9.8",
3
+ "version": "2.9.9",
4
4
  "license": "Apache 2.0",
5
5
  "description": "Bazaarvoice UI-related JavaScript",
6
6
  "repository": {