diff --git a/network/http/gin.go b/network/http/gin.go index 74bb977d..5d643587 100644 --- a/network/http/gin.go +++ b/network/http/gin.go @@ -310,12 +310,12 @@ func GinGetArg(c *gin.Context, hdr, param string) (v string, err error) { func Unzip(in []byte) (out []byte, err error) { gzr, err := gzip.NewReader(bytes.NewBuffer(in)) if err != nil { - return + return nil, fmt.Errorf("unable to new gzip reader: %w", err) } out, err = io.ReadAll(gzr) if err != nil { - return + return out, fmt.Errorf("unable to ReadAll from gzip reader: %w", err) } if err := gzr.Close(); err != nil { diff --git a/network/http/http.go b/network/http/http.go index 1a2860ac..1413dc4d 100644 --- a/network/http/http.go +++ b/network/http/http.go @@ -7,6 +7,7 @@ package http import ( + "fmt" "io" "net/http" ) @@ -15,7 +16,7 @@ import ( func ReadBody(req *http.Request) ([]byte, error) { buf, err := io.ReadAll(req.Body) if err != nil { - return nil, err + return nil, fmt.Errorf("io ReadAll in ReadBody: %w", err) } // as HTTP server, we do not need to close body