Skip to content

Commit

Permalink
builder/source/simple: Initialize our own grab client
Browse files Browse the repository at this point in the history
Instead of initializing a `NewClient()`

Co-authored-by: Silke Hofstra <[email protected]>
  • Loading branch information
joebonrichie and silkeh authored Dec 12, 2023
1 parent 2b86832 commit e6e14ad
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions builder/source/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,18 @@ func (s *SimpleSource) download(destination string) error {
req.SetChecksum(sha256.New(), sum, false)
}

// Keep go-grab defaults but also disable compression
// https://github.com/cavaliergopher/grab/blob/v3.0.1/v3/client.go#L53
tr := &http.Transport{
DisableCompression: true,
Proxy: http.ProxyFromEnvironment,
// Create a client with compression disabled.
// See: https://github.com/cavaliergopher/grab/blob/v3.0.1/v3/client.go#L53
client := &grab.Client{
UserAgent: "solbuild",
HTTPClient: &http.Client{
Transport: &http.Transport{
DisableCompression: true,
Proxy: http.ProxyFromEnvironment,
}

Check failure on line 149 in builder/source/simple.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 149 in builder/source/simple.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 149 in builder/source/simple.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in composite literal; possibly missing comma or }
}

Check failure on line 150 in builder/source/simple.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in composite literal; possibly missing comma or } (typecheck)

Check failure on line 150 in builder/source/simple.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in composite literal; possibly missing comma or }) (typecheck)

Check failure on line 150 in builder/source/simple.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in composite literal; possibly missing comma or }) (typecheck)
}

client := grab.NewClient()
client.HTTPClient = &http.Client{Transport: tr}

resp := client.Do(req)

// Setup our progress bar
Expand Down

0 comments on commit e6e14ad

Please sign in to comment.