From 7d3c4a26fe0d83f7180458538092423d26aea898 Mon Sep 17 00:00:00 2001 From: kandrusyak Date: Mon, 25 Sep 2023 22:17:14 +0300 Subject: [PATCH] logs fix --- pkg/api/apiCall.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pkg/api/apiCall.go b/pkg/api/apiCall.go index 39af217..9e7a6b0 100644 --- a/pkg/api/apiCall.go +++ b/pkg/api/apiCall.go @@ -20,10 +20,8 @@ func PostRequest(url string, model any, header http.Header, c echo.Context) ([]b req.Header = header req.Header.Set("Content-Type", "application/json") - if err != nil { - c.Logger().Debug("Request---") - c.Logger().Debug(string(uJson)) - } + c.Logger().Debug("Request---") + c.Logger().Debug(string(uJson)) resp, err := client.Do(req) @@ -39,7 +37,7 @@ func PostRequest(url string, model any, header http.Header, c echo.Context) ([]b debug, err := json.Marshal(resp.Body) - if err != nil { + if err == nil { c.Logger().Debug("Response---") c.Logger().Debug(string(debug)) } @@ -56,10 +54,8 @@ func GetRequest(url string, header http.Header, c echo.Context, args ...string) req.Header = header req.Header.Set("Content-Type", "application/json") - if err != nil { - c.Logger().Debug("Request---") - c.Logger().Debug(req.URL.String()) - } + c.Logger().Debug("Request---") + c.Logger().Debug(req.URL.String()) resp, err := client.Do(req) @@ -75,7 +71,7 @@ func GetRequest(url string, header http.Header, c echo.Context, args ...string) debug, err := json.Marshal(resp.Body) - if err != nil { + if err == nil { c.Logger().Debug("Response---") c.Logger().Debug(string(debug)) }