Skip to content

Commit 06859bd

Browse files
authored
Merge pull request #190 from akinazuki/fix/service-binding-fetch-illegal-invocation
fix: use Call instead of Get+Invoke in fetch to preserve `this` for service bindings
2 parents 01b96bc + 8317257 commit 06859bd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cloudflare/fetch/bind.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ func fetch(namespace js.Value, req *http.Request, init *RequestInit) (*http.Resp
1515
if namespace.IsUndefined() {
1616
return nil, errors.New("fetch function not found")
1717
}
18-
fetchFunc := namespace.Get("fetch")
19-
promise := fetchFunc.Invoke(
18+
promise := namespace.Call("fetch",
2019
// The Request object to fetch.
2120
// Docs: https://developers.cloudflare.com/workers/runtime-apis/request
2221
jshttp.ToJSRequest(req),

0 commit comments

Comments
 (0)