We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ccbaff0 commit 269de2eCopy full SHA for 269de2e
compiler/natives/net/http/http.go
@@ -41,12 +41,12 @@ func (t *XHRTransport) RoundTrip(req *Request) (*Response, error) {
41
body := js.Global.Get("Uint8Array").New(xhr.Get("response")).Interface().([]byte)
42
43
contentLength := int64(-1)
44
- if req.Method == "HEAD" {
45
- i, err := strconv.ParseInt(header.Get("Content-Length"), 10, 64)
46
- if err == nil {
47
- contentLength = i
+ switch req.Method {
+ case "HEAD":
+ if l, err := strconv.ParseInt(header.Get("Content-Length"), 10, 64); err == nil {
+ contentLength = l
48
}
49
- } else {
+ default:
50
contentLength = int64(len(body))
51
52
0 commit comments