Skip to content

Commit

Permalink
chore: add support for POST data in cache interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Jan 23, 2024
1 parent 72312c9 commit 2c0480c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/cache/src/cache.interceptor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ describe('cache: interceptor', () => {
httpBed.expectOne('/test').flush(res, { headers: { 'cache-control': 'max-age=60' } });
});

it('should be support POST data', done => {
const key = 'b';
const res = 'ok';
http.post(key, { responseType: 'text', context: new HttpContext().set(CACHE, { key }) }).subscribe(() => {
expect((cacheSrv.getNone(key) as HttpResponse<string>)?.body).toBe(res);
done();
});
httpBed.expectOne(key).flush(res, { headers: { 'cache-control': 'max-age=60' } });
});

describe('Ignore cache', () => {
it('when response cache-control', done => {
const key = 'b';
Expand Down

0 comments on commit 2c0480c

Please sign in to comment.