From f8be6c223b1ca5c35cde51d2f874793f78e2daa9 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期三, 12 八月 2020 11:35:00 +0800 Subject: [PATCH] DoPostRequest set 60 sec timeout --- extend/util/requtil.go | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extend/util/requtil.go b/extend/util/requtil.go index ee2f1da..e1877e1 100644 --- a/extend/util/requtil.go +++ b/extend/util/requtil.go @@ -3,14 +3,15 @@ import ( "bytes" "encoding/json" + "fmt" "github.com/ajg/form" - "golang.org/x/tools/go/ssa/interp/testdata/src/fmt" "io" "io/ioutil" "net/http" "os" "strings" "github.com/dustin/go-humanize" + "time" ) const ( @@ -63,7 +64,9 @@ request.Header.Add(key, val) } } - client := &http.Client{} + client := &http.Client{ + Timeout: time.Second * 60, + } resp, err := client.Do(request) if err != nil { return resultBytes, err -- Gitblit v1.8.0