Skip to content

Commit

Permalink
fix(service-worker): refer to self.fetch correctly (#3200)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe authored Jul 29, 2024
1 parent 43fe52c commit f0b012d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/adapter/service-worker/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const handle = (
opts: {
fetch?: typeof fetch
} = {
fetch: fetch,
// To use `fetch` on a Service Worker correctly, first refer to `self.fetch`.
fetch: globalThis.self !== undefined ? globalThis.self.fetch : fetch,
}
): Handler => {
return (evt) => {
Expand Down

0 comments on commit f0b012d

Please sign in to comment.