Skip to content

net/http: client always uses TinyGo roundTrip instead of roundTrip_js in wasm #66

Open

Description

@Darckfast

when compiling to wasm, the net/http client should be using the JS roundTrip, but it always uses the TinyGo default roundTrip

resp, err = roundTrip(req)

as a result, whenever you make an http request in wasm, you always get the Netdev not set error, but it should be using the JS runtime to handle the request

at the moment the workaround is to pass a Transport when creating the http client e.g.

c := http.Client{
  Transport: http.DefaultTransport,
}

net/http/client.go

Lines 433 to 439 in 1026408

func (c *Client) Do(req *Request) (*Response, error) {
if c.Transport != nil {
return c.Transport.RoundTrip(req)
}
return c.do(req)
}

Activity

  1. changed the title [-]net/http client always uses TinyGo `roundTrip` instead of `roundTrip_js` in wasm[/-] [+]net/http: client always uses TinyGo `roundTrip` instead of `roundTrip_js` in wasm[/+] on Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions