mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
refactor: used triple equal sign
This commit is contained in:
parent
ab53ac13dd
commit
1b93070db4
@ -32,7 +32,7 @@ export function defaultRequestInterceptor(axios: AxiosCacheInstance) {
|
||||
let cache = await axios.storage.get(key);
|
||||
|
||||
// Not cached, continue the request, and mark it as fetching
|
||||
emptyOrStale: if (cache.state == 'empty' || cache.state === 'stale') {
|
||||
emptyOrStale: if (cache.state === 'empty' || cache.state === 'stale') {
|
||||
/**
|
||||
* This checks for simultaneous access to a new key. The js event loop jumps on the
|
||||
* first await statement, so the second (asynchronous call) request may have already
|
||||
|
||||
@ -74,15 +74,15 @@ describe('tests cache predicate object', () => {
|
||||
});
|
||||
|
||||
const headerExists = isCachePredicateValid(response, {
|
||||
containsHeaders: { 'content-type': (header) => header == 'application/json' }
|
||||
containsHeaders: { 'content-type': (header) => header === 'application/json' }
|
||||
});
|
||||
|
||||
const isXmlContent = isCachePredicateValid(response, {
|
||||
containsHeaders: { 'Content-Type': (header) => header == 'application/xml' }
|
||||
containsHeaders: { 'Content-Type': (header) => header === 'application/xml' }
|
||||
});
|
||||
|
||||
const isJsonContent = isCachePredicateValid(response, {
|
||||
containsHeaders: { 'Content-Type': (header) => header == 'application/json' }
|
||||
containsHeaders: { 'Content-Type': (header) => header === 'application/json' }
|
||||
});
|
||||
|
||||
expect(headerExists).toBeFalsy();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user