mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-28 03:15:16 +00:00
27 lines
677 B
JavaScript
27 lines
677 B
JavaScript
|
/*
|
||
|
Copyright 2018 Google LLC
|
||
|
|
||
|
Use of this source code is governed by an MIT-style
|
||
|
license that can be found in the LICENSE file or at
|
||
|
https://opensource.org/licenses/MIT.
|
||
|
*/
|
||
|
import '../_version.js';
|
||
|
export const cacheOkAndOpaquePlugin = {
|
||
|
/**
|
||
|
* Returns a valid response (to allow caching) if the status is 200 (OK) or
|
||
|
* 0 (opaque).
|
||
|
*
|
||
|
* @param {Object} options
|
||
|
* @param {Response} options.response
|
||
|
* @return {Response|null}
|
||
|
*
|
||
|
* @private
|
||
|
*/
|
||
|
cacheWillUpdate: async ({ response }) => {
|
||
|
if (response.status === 200 || response.status === 0) {
|
||
|
return response;
|
||
|
}
|
||
|
return null;
|
||
|
},
|
||
|
};
|