From a603acbe4e83d0d51629c3f69aa9460af7f71956 Mon Sep 17 00:00:00 2001 From: Pavel Date: Wed, 14 Aug 2019 14:18:12 +0300 Subject: [PATCH] don't log file data while uploading --- v1/request.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/v1/request.go b/v1/request.go index 5c72f37..73c8813 100644 --- a/v1/request.go +++ b/v1/request.go @@ -7,6 +7,7 @@ import ( "io/ioutil" "log" "net/http" + "strings" ) var prefix = "/api/transport/v1" @@ -62,7 +63,11 @@ func makeRequest(reqType, url string, buf io.Reader, c *MgClient) ([]byte, int, req.Header.Set("X-Transport-Token", c.Token) if c.Debug { - log.Printf("MG TRANSPORT API Request: %s %s %s %v", reqType, url, c.Token, buf) + if strings.Index(url, "/files/upload") != -1 { + log.Printf("MG TRANSPORT API Request: %s %s %s [file data]", reqType, url, c.Token) + } else { + log.Printf("MG TRANSPORT API Request: %s %s %s %v", reqType, url, c.Token, buf) + } } resp, err := c.httpClient.Do(req)