Skip to content

Commit

Permalink
devtool: Close http client request body (#126)
Browse files Browse the repository at this point in the history
Fix http client request socket descriptor leakage
  • Loading branch information
septemhill committed May 18, 2021
1 parent 75c683f commit fd8f409
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion devtool/devtool.go
Expand Up @@ -283,7 +283,12 @@ func (d *DevTools) resolveHost(ctx context.Context) error {
}

resp, err := d.client.Do(req.WithContext(ctx))
if err == nil && resp.StatusCode == 200 {
if err != nil {
continue
}
defer resp.Body.Close()

if resp.StatusCode == 200 {
newURL = try
break
}
Expand Down

0 comments on commit fd8f409

Please sign in to comment.