From 34a1b67966bfd810ea871643f2e38b106d0c6f9b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Oct 2021 20:06:44 +0000 Subject: [PATCH] Bump github.com/imroc/req from 0.3.0 to 0.3.1 Bumps [github.com/imroc/req](https://github.com/imroc/req) from 0.3.0 to 0.3.1. - [Release notes](https://github.com/imroc/req/releases) - [Commits](https://github.com/imroc/req/compare/v0.3.0...v0.3.1) --- updated-dependencies: - dependency-name: github.com/imroc/req dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 ++---- vendor/github.com/imroc/req/README.md | 6 +++--- vendor/github.com/imroc/req/dump.go | 5 +++-- vendor/github.com/imroc/req/req.go | 11 +++++++---- vendor/github.com/imroc/req/resp.go | 4 ++-- vendor/modules.txt | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 9c7c827..a00fa28 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/solarhell/qq-miniprogram go 1.12 -require github.com/imroc/req v0.3.0 +require github.com/imroc/req v0.3.1 diff --git a/go.sum b/go.sum index 0f3680c..4c0bc6b 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,2 @@ -github.com/imroc/req v0.2.4 h1:8XbvaQpERLAJV6as/cB186DtH5f0m5zAOtHEaTQ4ac0= -github.com/imroc/req v0.2.4/go.mod h1:J9FsaNHDTIVyW/b5r6/Df5qKEEEq2WzZKIgKSajd1AE= -github.com/imroc/req v0.3.0 h1:3EioagmlSG+z+KySToa+Ylo3pTFZs+jh3Brl7ngU12U= -github.com/imroc/req v0.3.0/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw= +github.com/imroc/req v0.3.1 h1:ecp5ffcLzAALwgR7egwq7ptN3057RQXlANLaki2gXAk= +github.com/imroc/req v0.3.1/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw= diff --git a/vendor/github.com/imroc/req/README.md b/vendor/github.com/imroc/req/README.md index 7d54deb..8319dab 100644 --- a/vendor/github.com/imroc/req/README.md +++ b/vendor/github.com/imroc/req/README.md @@ -81,7 +81,7 @@ param := req.Param{ "cmd": "add", } // only url is required, others are optional. -r, err = req.Post("http://foo.bar/api", header, param) +r, err := req.Post("http://foo.bar/api", header, param) if err != nil { log.Fatal(err) } @@ -161,7 +161,7 @@ req.Post(url, req.BodyXML(&bar)) ``` ## Debug -Set global variable `req.Debug` to true, it will print detail infomation for every request. +Set global variable `req.Debug` to true, it will print detail information for every request. ``` go req.Debug = true req.Post("http://localhost/test" "hi") @@ -169,7 +169,7 @@ req.Post("http://localhost/test" "hi") ![post](doc/post.png) ## Output Format -You can use different kind of output format to log the request and response infomation in your log file in defferent scenarios. For example, use `%+v` output format in the development phase, it allows you to observe the details. Use `%v` or `%-v` output format in production phase, just log the information necessarily. +You can use different kind of output format to log the request and response information in your log file in defferent scenarios. For example, use `%+v` output format in the development phase, it allows you to observe the details. Use `%v` or `%-v` output format in production phase, just log the information necessarily. ### `%+v` or `%+s` Output in detail diff --git a/vendor/github.com/imroc/req/dump.go b/vendor/github.com/imroc/req/dump.go index ce6d3a5..52e527e 100644 --- a/vendor/github.com/imroc/req/dump.go +++ b/vendor/github.com/imroc/req/dump.go @@ -207,10 +207,11 @@ func (r *Resp) Dump() string { l := dump.Len() if l > 0 { dump.WriteString("=================================") - l = dump.Len() } - r.dumpResponse(dump) + if r.resp != nil { + r.dumpResponse(dump) + } return dump.String() } diff --git a/vendor/github.com/imroc/req/req.go b/vendor/github.com/imroc/req/req.go index 01937f0..452547d 100644 --- a/vendor/github.com/imroc/req/req.go +++ b/vendor/github.com/imroc/req/req.go @@ -171,6 +171,13 @@ func (r *Req) Do(method, rawurl string, vs ...interface{}) (resp *Resp, err erro } resp = &Resp{req: req, r: r} + // output detail if Debug is enabled + if Debug { + defer func(resp *Resp) { + fmt.Println(resp.Dump()) + }(resp) + } + var queryParam param var formParam param var uploads []FileUpload @@ -340,10 +347,6 @@ func (r *Req) Do(method, rawurl string, vs ...interface{}) (resp *Resp, err erro response.Body = body } - // output detail if Debug is enabled - if Debug { - fmt.Println(resp.Dump()) - } return } diff --git a/vendor/github.com/imroc/req/resp.go b/vendor/github.com/imroc/req/resp.go index b464c2b..e5c36fc 100644 --- a/vendor/github.com/imroc/req/resp.go +++ b/vendor/github.com/imroc/req/resp.go @@ -43,7 +43,7 @@ func (r *Resp) Bytes() []byte { } // ToBytes returns response body as []byte, -// return error if error happend when reading +// return error if error happened when reading // the response body func (r *Resp) ToBytes() ([]byte, error) { if r.err != nil { @@ -69,7 +69,7 @@ func (r *Resp) String() string { } // ToString returns response body as string, -// return error if error happend when reading +// return error if error happened when reading // the response body func (r *Resp) ToString() (string, error) { data, err := r.ToBytes() diff --git a/vendor/modules.txt b/vendor/modules.txt index 7379466..4fd1cc5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,2 +1,2 @@ -# github.com/imroc/req v0.3.0 +# github.com/imroc/req v0.3.1 github.com/imroc/req