@@ -41,9 +41,18 @@ const (
4141 Error LocalStackStatus = "error"
4242)
4343
44+ // transport with disabled proxy, to avoid issues with customers having proxies configured in their environment
45+ // should be used for all communication with the LocalStack instance
46+ var transport http.RoundTripper = & http.Transport {
47+ Proxy : nil ,
48+ }
49+
4450func (l * LocalStackAdapter ) SendStatus (status LocalStackStatus , payload []byte ) error {
51+ client := & http.Client {
52+ Transport : transport ,
53+ }
4554 statusUrl := fmt .Sprintf ("%s/status/%s/%s" , l .UpstreamEndpoint , l .RuntimeId , status )
46- _ , err := http .Post (statusUrl , "application/json" , bytes .NewReader (payload ))
55+ _ , err := client .Post (statusUrl , "application/json" , bytes .NewReader (payload ))
4756 if err != nil {
4857 return err
4958 }
@@ -76,6 +85,9 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate interop.Server, logCollecto
7685 RuntimeId : lsOpts .RuntimeId ,
7786 },
7887 }
88+ client := & http.Client {
89+ Transport : transport ,
90+ }
7991
8092 // TODO: extract this
8193 go func () {
@@ -159,7 +171,7 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate interop.Server, logCollecto
159171
160172 serializedLogs , err2 := json .Marshal (logCollector .getLogs ())
161173 if err2 == nil {
162- _ , err2 = http .Post (server .upstreamEndpoint + "/invocations/" + invokeR .InvokeId + "/logs" , "application/json" , bytes .NewReader (serializedLogs ))
174+ _ , err2 = client .Post (server .upstreamEndpoint + "/invocations/" + invokeR .InvokeId + "/logs" , "application/json" , bytes .NewReader (serializedLogs ))
163175 // TODO: handle err
164176 }
165177
@@ -172,13 +184,13 @@ func NewCustomInteropServer(lsOpts *LsOpts, delegate interop.Server, logCollecto
172184
173185 if isErr {
174186 log .Infoln ("Sending to /error" )
175- _ , err = http .Post (server .upstreamEndpoint + "/invocations/" + invokeR .InvokeId + "/error" , "application/json" , bytes .NewReader (invokeResp .Body ))
187+ _ , err = client .Post (server .upstreamEndpoint + "/invocations/" + invokeR .InvokeId + "/error" , "application/json" , bytes .NewReader (invokeResp .Body ))
176188 if err != nil {
177189 log .Error (err )
178190 }
179191 } else {
180192 log .Infoln ("Sending to /response" )
181- _ , err = http .Post (server .upstreamEndpoint + "/invocations/" + invokeR .InvokeId + "/response" , "application/json" , bytes .NewReader (invokeResp .Body ))
193+ _ , err = client .Post (server .upstreamEndpoint + "/invocations/" + invokeR .InvokeId + "/response" , "application/json" , bytes .NewReader (invokeResp .Body ))
182194 if err != nil {
183195 log .Error (err )
184196 }
0 commit comments