Skip to content

Commit

Permalink
fix: override and hydrate globally (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Oct 23, 2023
1 parent 356ec36 commit 892649c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cache/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export function setupCache(

staleIfError: options.staleIfError ?? true,

override: false,
override: options.override ?? false,

hydrate: undefined
hydrate: options.hydrate ?? undefined
};

// Apply interceptors
Expand Down
8 changes: 8 additions & 0 deletions test/interceptors/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,14 @@ describe('Request Interceptor', () => {
}
});

it('ensures override can be used globally', async () => {
const axios = mockAxios({ override: true });

const { config } = await axios.get('url');

assert.equal((config.cache as any).override, true);
});

it('Requests are made with CacheControl no-cache', async () => {
const axios = mockAxios({ cacheTakeover: true });

Expand Down

0 comments on commit 892649c

Please sign in to comment.