Skip to content

Commit

Permalink
fix incompleted reponse compute
Browse files Browse the repository at this point in the history
  • Loading branch information
faceair committed May 3, 2023
1 parent e309db1 commit b769ae5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ func TestProxy(proxy C.Proxy, downloadSize int, timeout time.Duration) *Result {
}
ttfb := time.Since(start)

io.Copy(io.Discard, resp.Body)
written, _ := io.Copy(io.Discard, resp.Body)
if written == 0 {
return &Result{-1, -1}
}
downloadSize = int(written)
downloadTime := time.Since(start) - ttfb
bandwidth := float64(downloadSize) / downloadTime.Seconds()

Expand Down

0 comments on commit b769ae5

Please sign in to comment.