github.com/webdestroya/awsmocker@v0.2.6/http_test.go (about) 1 package awsmocker_test 2 3 import ( 4 "net/http" 5 "net/url" 6 "os" 7 "testing" 8 9 "github.com/stretchr/testify/require" 10 "github.com/webdestroya/awsmocker" 11 ) 12 13 func TestProxyHttp(t *testing.T) { 14 awsmocker.Start(t, &awsmocker.MockerOptions{ 15 DoNotFailUnhandledRequests: true, 16 }) 17 18 transport := http.Transport{} 19 proxyUrl, _ := url.Parse(os.Getenv("HTTP_PROXY")) 20 transport.Proxy = http.ProxyURL(proxyUrl) // set proxy 21 // transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //set ssl 22 23 client := &http.Client{ 24 Transport: &transport, 25 } 26 httpresp, err := client.Get("http://example.com/") 27 require.NoError(t, err) 28 defer httpresp.Body.Close() 29 }