From 11226ee2ef32ea34e526f141e4b00c149a30cf11 Mon Sep 17 00:00:00 2001 From: Huakun Shen Date: Sun, 23 Mar 2025 10:26:18 -0400 Subject: [PATCH] fix: jsr API for cloudflare worker env Without this header will get html format instead of json in cf worker --- packages/package-registry/src/jsr/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/package-registry/src/jsr/index.ts b/packages/package-registry/src/jsr/index.ts index 41bfbc1..66d12bb 100644 --- a/packages/package-registry/src/jsr/index.ts +++ b/packages/package-registry/src/jsr/index.ts @@ -119,7 +119,11 @@ export function getJsrPackageSrcFile( file: string ): Promise { const url = `https://jsr.io/@${scope}/${name}/${version}/${file}` - return fetch(url).then((res) => res.text()) + return fetch(url, { + headers: { + Accept: "application/json" + } + }).then((res) => res.text()) } /**