From bf8f8894374448281f36d1b39a69b27c881eafa3 Mon Sep 17 00:00:00 2001 From: josh Date: Wed, 17 Apr 2024 09:11:55 +0200 Subject: [PATCH] fix: cloudflare incompatibility --- index.ts | 4 +++- src/http/index.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 57ea503..2d96bce 100644 --- a/index.ts +++ b/index.ts @@ -116,7 +116,9 @@ export class Index< baseUrl: url, retry: configOrRequester?.retry, headers: { authorization: `Bearer ${token}` }, - cache: configOrRequester?.cache || "no-store", + cache: configOrRequester?.cache === false + ? undefined + : configOrRequester?.cache || "no-store", signal: configOrRequester?.signal, }); diff --git a/src/http/index.ts b/src/http/index.ts index 1344842..97b2b46 100644 --- a/src/http/index.ts +++ b/src/http/index.ts @@ -6,7 +6,8 @@ type CacheSetting = | "no-cache" | "no-store" | "only-if-cached" - | "reload"; + | "reload" + | false; export type UpstashRequest = { path?: string[];