From d99a9e1c469dba774adf8e44156534da52c3b2e9 Mon Sep 17 00:00:00 2001 From: lemonknowsall Date: Sat, 10 Jan 2026 14:27:57 -0800 Subject: [PATCH] fix illegal invocation error on fetch --- src/lib/git.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/git.ts b/src/lib/git.ts index 12a09386..5910f6ff 100644 --- a/src/lib/git.ts +++ b/src/lib/git.ts @@ -1107,7 +1107,8 @@ class GitHttp implements HttpClient { constructor(proxy?: string, fetch?: typeof globalThis.fetch) { this.proxy = proxy; - this.fetch = fetch ?? globalThis.fetch; + // Bind fetch to globalThis to preserve context when called as this.fetch() + this.fetch = fetch ?? globalThis.fetch.bind(globalThis); } async request(request: GitHttpRequest): Promise {