From 0d5ab1dfbf67d6c616c22722aa550e68cf88401a Mon Sep 17 00:00:00 2001 From: Nick Randall Date: Fri, 20 Sep 2024 12:56:06 -0700 Subject: [PATCH] fix(node-http-handler): omit setting cache setting on request init when using default value (#1411) * Fixes #1407 --- .changeset/good-cheetahs-wait.md | 5 +++++ packages/fetch-http-handler/src/fetch-http-handler.ts | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/good-cheetahs-wait.md diff --git a/.changeset/good-cheetahs-wait.md b/.changeset/good-cheetahs-wait.md new file mode 100644 index 00000000000..dcabe3dd985 --- /dev/null +++ b/.changeset/good-cheetahs-wait.md @@ -0,0 +1,5 @@ +--- +"@smithy/fetch-http-handler": patch +--- + +Omit setting cache setting on request init when using default value diff --git a/packages/fetch-http-handler/src/fetch-http-handler.ts b/packages/fetch-http-handler/src/fetch-http-handler.ts index 2d24b4dae5c..6f0caac4fdc 100644 --- a/packages/fetch-http-handler/src/fetch-http-handler.ts +++ b/packages/fetch-http-handler/src/fetch-http-handler.ts @@ -112,8 +112,12 @@ export class FetchHttpHandler implements HttpHandler { headers: new Headers(request.headers), method: method, credentials, - cache: this.config!.cache ?? "default", }; + // cache property is not supported in workerd runtime + // TODO: can we feature detect support for cache and not set this property when not supported? + if (this.config?.cache) { + requestOptions.cache = this.config.cache; + } if (body) { requestOptions.duplex = "half";