1
0
mirror of synced 2024-11-25 14:36:03 +03:00

Merge pull request #53 from Neur0toxine/master

[fix] don't log file data while uploading
This commit is contained in:
Alex Lushpai 2019-08-14 14:19:54 +03:00 committed by GitHub
commit 7d65da6c29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
"strings"
) )
var prefix = "/api/transport/v1" var prefix = "/api/transport/v1"
@ -62,8 +63,12 @@ func makeRequest(reqType, url string, buf io.Reader, c *MgClient) ([]byte, int,
req.Header.Set("X-Transport-Token", c.Token) req.Header.Set("X-Transport-Token", c.Token)
if c.Debug { if c.Debug {
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) log.Printf("MG TRANSPORT API Request: %s %s %s %v", reqType, url, c.Token, buf)
} }
}
resp, err := c.httpClient.Do(req) resp, err := c.httpClient.Do(req)
if err != nil { if err != nil {