We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b31899b commit c1b775aCopy full SHA for c1b775a
internal/http_executor.go
@@ -17,9 +17,11 @@ limitations under the License.
17
package internal
18
19
import (
20
+ "context"
21
"fmt"
22
"io"
23
"net/http"
24
+ "time"
25
)
26
27
type Request struct {
@@ -63,7 +65,9 @@ func NewHttpExecutor(httpClient HttpClient) Executor {
63
65
}
64
66
67
func (executor *httpExecutor) Execute(req *Request) (*Response, error) {
- resp, err := executor.Client.Do(req.Req)
68
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
69
+ defer cancel()
70
+ resp, err := executor.Client.Do(req.Req.WithContext(ctx))
71
if err != nil {
72
return nil, err
73
0 commit comments