Skip to content

Commit fb4bdb6

Browse files
committed
net/http: only disable fetch in test
1 parent 1b5ae45 commit fb4bdb6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/net/http/roundtrip_js.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"io"
1313
"net/http/internal/ascii"
1414
"strconv"
15-
"strings"
1615
"syscall/js"
16+
"testing"
1717
)
1818

1919
var uint8Array = js.Global().Get("Uint8Array")
@@ -53,8 +53,7 @@ var jsFetchMissing = js.Global().Get("fetch").IsUndefined()
5353
//
5454
// TODO(go.dev/issue/60810): See if it's viable to test the Fetch API
5555
// code path.
56-
var jsFetchDisabled = js.Global().Get("process").Type() == js.TypeObject &&
57-
strings.HasPrefix(js.Global().Get("process").Get("argv0").String(), "node")
56+
var jsFetchDisabled = testing.Testing()
5857

5958
// RoundTrip implements the [RoundTripper] interface using the WHATWG Fetch API.
6059
func (t *Transport) RoundTrip(req *Request) (*Response, error) {

0 commit comments

Comments
 (0)