Skip to content
Snippets Groups Projects
Commit 408a850b authored by Anatolii Prylutskyi's avatar Anatolii Prylutskyi
Browse files

Add logs for debuging

parent 0fb7fc9b
Branches
Tags
No related merge requests found
......@@ -14,6 +14,7 @@ import (
"github.com/pkg/errors"
"gitlab.qarea.org/bkp/cfg"
"gitlab.qarea.org/tgms/ctxtg"
"gitlab.qarea.org/tgms/redminems/entities"
)
......@@ -68,6 +69,12 @@ func redmineRequest(opts requestOpts) error {
if err != nil {
return errors.Wrap(err, "failed read body")
}
if cfg.Debug {
bodyBytes, _ := json.Marshal(opts.body)
log.DEBUG("Login: %v \n Request: %v \n Response: %v \n", opts.tracker.Credentials.Login, string(bodyBytes), string(b))
}
if resp.StatusCode == 422 {
return errors.Wrapf(toExternalServiceErr(b), "invalid object passed to redmine, response body: %s", string(b))
}
......@@ -88,7 +95,7 @@ func redmineRequest(opts requestOpts) error {
return nil
}
func validateStatusCodes(expected ...int) func(s int) error {
func validateStatusCodes(expected ...int) func(int) error {
return func(s int) error {
for _, e := range expected {
if s == e {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment