From e834f587af0c324692076bb6f6abd0906132aee3 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Sat, 25 Apr 2026 16:59:47 +0200 Subject: [PATCH] http: fix t.roundTrip undefined on js/wasm builds The js/wasm RoundTrip fallback called t.roundTrip(req), an upstream Go private method that was never backported to TinyGo's Transport stub. Replace the call with an explicit error return, since the empty Transport has no dial capability and cannot perform a fallback round-trip. Fixes #52 Signed-off-by: deadprogram --- http/roundtrip_js.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/http/roundtrip_js.go b/http/roundtrip_js.go index 344b8a3..e693538 100644 --- a/http/roundtrip_js.go +++ b/http/roundtrip_js.go @@ -68,9 +68,11 @@ func (t *Transport) RoundTrip(req *Request) (*Response, error) { // to fall back on the Fetch API, unless it's not available. // TINYGO: Dial/DialTLS & DialContext/DialTLSContext are not present in tinygo Transport struct, therefore the - // corresponding if statements were removed + // corresponding if statements were removed. + // TINYGO: t.roundTrip (the private fallback used by upstream Go) is not present in the TinyGo stub + // Transport, so return an error when the Fetch API is unavailable instead of calling it. if jsFetchMissing || jsFetchDisabled { - return t.roundTrip(req) + return nil, errors.New("net/http: Fetch API is not available and no fallback transport is implemented for js/wasm") } ac := js.Global().Get("AbortController")