Add debug log to HTTP request (#252)

This commit is contained in:
Sung Won Cho 2019-09-26 09:40:19 +08:00 committed by GitHub
commit d71abdb150
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,6 +32,7 @@ import (
"github.com/dnote/dnote/pkg/cli/context"
"github.com/dnote/dnote/pkg/cli/crypt"
"github.com/dnote/dnote/pkg/cli/log"
"github.com/pkg/errors"
)
@ -83,6 +84,8 @@ func doReq(ctx context.DnoteCtx, method, path, body string, options *requestOpti
return nil, errors.Wrap(err, "getting request")
}
log.Debug("HTTP request: %+v\n", req)
var hc http.Client
if options != nil && options.HTTPClient != nil {
hc = *options.HTTPClient