move custom http client creation with env proxy args into same package as other network related helpers
This commit is contained in:
parent
7b57e28600
commit
45b5f0c2ee
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
commonhelper "github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/net"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ func (s *stepSetISO) Run(ctx context.Context, state multistep.StateBag) multiste
|
|||
|
||||
req.Header.Set("User-Agent", "Packer")
|
||||
|
||||
httpClient := commonhelper.HttpClientWithEnvironmentProxy()
|
||||
httpClient := net.HttpClientWithEnvironmentProxy()
|
||||
|
||||
res, err := httpClient.Do(req)
|
||||
if err == nil && (res.StatusCode >= 200 && res.StatusCode < 300) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package common
|
||||
package net
|
||||
|
||||
import (
|
||||
"net/http"
|
|
@ -11,7 +11,7 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
commonhelper "github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/net"
|
||||
)
|
||||
|
||||
type VagrantCloudClient struct {
|
||||
|
@ -48,7 +48,7 @@ func (v VagrantCloudErrors) FormatErrors() string {
|
|||
|
||||
func (v VagrantCloudClient) New(baseUrl string, token string, InsecureSkipTLSVerify bool) (*VagrantCloudClient, error) {
|
||||
c := &VagrantCloudClient{
|
||||
client: commonhelper.HttpClientWithEnvironmentProxy(),
|
||||
client: net.HttpClientWithEnvironmentProxy(),
|
||||
BaseURL: baseUrl,
|
||||
AccessToken: token,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue