Skip to content

Commit 269de2e

Browse files
committed
small code style changes
1 parent ccbaff0 commit 269de2e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/natives/net/http/http.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ func (t *XHRTransport) RoundTrip(req *Request) (*Response, error) {
4141
body := js.Global.Get("Uint8Array").New(xhr.Get("response")).Interface().([]byte)
4242

4343
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
44+
switch req.Method {
45+
case "HEAD":
46+
if l, err := strconv.ParseInt(header.Get("Content-Length"), 10, 64); err == nil {
47+
contentLength = l
4848
}
49-
} else {
49+
default:
5050
contentLength = int64(len(body))
5151
}
5252

0 commit comments

Comments
 (0)