github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/compiler/natives/src/net/http/http_wasm_test.go (about)

     1  //go:build js && wasm
     2  // +build js,wasm
     3  
     4  package http
     5  
     6  func init() {
     7  	// Use standard transport with fake networking under tests. Although GopherJS
     8  	// supports "real" http.Client implementations using Fetch or XMLHttpRequest
     9  	// APIs, tests also need to start local web servers, which is not supported
    10  	// for those APIs.
    11  	// TODO(nevkontakte): We could test our real implementations if we mock out
    12  	// browser APIs and redirect them to the fake networking stack, but this is
    13  	// not easy.
    14  	jsFetchMissing = true
    15  	DefaultTransport = &Transport{}
    16  }