From 602dcba4d3c013c8383d9631864572fa9df5d472 Mon Sep 17 00:00:00 2001 From: Franco Fantini Date: Wed, 21 Jun 2023 16:11:31 -0300 Subject: [PATCH 1/2] feat(Nodejs): adds cache param to client --- pkg/http.ts | 7 ++++++- platforms/nodejs.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/http.ts b/pkg/http.ts index 79905366..e6fbc38b 100644 --- a/pkg/http.ts +++ b/pkg/http.ts @@ -81,6 +81,12 @@ export type RequesterConfig = { * @default "base64" */ responseEncoding?: false | "base64"; + + /** + * Configure the cache behaviour + * @default "no-store" + */ + cache?: CacheSetting; }; export type HttpClientConfig = { @@ -89,7 +95,6 @@ export type HttpClientConfig = { options?: Options; retry?: RetryConfig; agent?: any; - cache?: CacheSetting; } & RequesterConfig; export class HttpClient implements Requester { diff --git a/platforms/nodejs.ts b/platforms/nodejs.ts index e6e73a4d..603bb249 100644 --- a/platforms/nodejs.ts +++ b/platforms/nodejs.ts @@ -121,7 +121,7 @@ export class Redis extends core.Redis { headers: { authorization: `Bearer ${configOrRequester.token}` }, agent: configOrRequester.agent, responseEncoding: configOrRequester.responseEncoding, - cache: "no-store", + cache: configOrRequester.cache || 'no-store', }); super(client, { From e3b13de9ea8b359eba8e72df49b917e2c237141d Mon Sep 17 00:00:00 2001 From: Franco Fantini Date: Wed, 21 Jun 2023 16:14:34 -0300 Subject: [PATCH 2/2] feat(Nodejs): adds cache param to client --- platforms/nodejs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/nodejs.ts b/platforms/nodejs.ts index 603bb249..6ba97943 100644 --- a/platforms/nodejs.ts +++ b/platforms/nodejs.ts @@ -121,7 +121,7 @@ export class Redis extends core.Redis { headers: { authorization: `Bearer ${configOrRequester.token}` }, agent: configOrRequester.agent, responseEncoding: configOrRequester.responseEncoding, - cache: configOrRequester.cache || 'no-store', + cache: configOrRequester.cache || "no-store", }); super(client, {