diff --git a/pkg/cli/exec/command.go b/pkg/cli/exec/command.go index 16f136306..a3f53dbb4 100644 --- a/pkg/cli/exec/command.go +++ b/pkg/cli/exec/command.go @@ -2,13 +2,13 @@ package exec import ( "fmt" - "net/http" "github.com/aquaproj/aqua/v2/pkg/cli/profile" "github.com/aquaproj/aqua/v2/pkg/cli/util" "github.com/aquaproj/aqua/v2/pkg/cli/which" "github.com/aquaproj/aqua/v2/pkg/config" "github.com/aquaproj/aqua/v2/pkg/controller" + "github.com/aquaproj/aqua/v2/pkg/httpclient" "github.com/urfave/cli/v2" ) @@ -46,7 +46,7 @@ func (i *command) action(c *cli.Context) error { if err := util.SetParam(c, i.r.LogE, "exec", param, i.r.LDFlags); err != nil { return fmt.Errorf("parse the command line arguments: %w", err) } - ctrl, err := controller.InitializeExecCommandController(c.Context, param, http.DefaultClient, i.r.Runtime) + ctrl, err := controller.InitializeExecCommandController(c.Context, param, httpclient.Client, i.r.Runtime) if err != nil { return fmt.Errorf("initialize a ExecController: %w", err) } diff --git a/pkg/cli/install/command.go b/pkg/cli/install/command.go index fb055b739..bab1b4198 100644 --- a/pkg/cli/install/command.go +++ b/pkg/cli/install/command.go @@ -2,12 +2,12 @@ package install import ( "fmt" - "net/http" "github.com/aquaproj/aqua/v2/pkg/cli/profile" "github.com/aquaproj/aqua/v2/pkg/cli/util" "github.com/aquaproj/aqua/v2/pkg/config" "github.com/aquaproj/aqua/v2/pkg/controller" + "github.com/aquaproj/aqua/v2/pkg/httpclient" "github.com/urfave/cli/v2" ) @@ -84,7 +84,7 @@ func (i *command) action(c *cli.Context) error { if err := util.SetParam(c, i.r.LogE, "install", param, i.r.LDFlags); err != nil { return fmt.Errorf("parse the command line arguments: %w", err) } - ctrl, err := controller.InitializeInstallCommandController(c.Context, param, http.DefaultClient, i.r.Runtime) + ctrl, err := controller.InitializeInstallCommandController(c.Context, param, httpclient.Client, i.r.Runtime) if err != nil { return fmt.Errorf("initialize a InstallController: %w", err) } diff --git a/pkg/httpclient/client.go b/pkg/httpclient/client.go new file mode 100644 index 000000000..65fe1c967 --- /dev/null +++ b/pkg/httpclient/client.go @@ -0,0 +1,5 @@ +package httpclient + +import "net/http" + +var Client = &http.Client{}