Skip to content

Commit

Permalink
Merge pull request #8 from inloco/incident-167-debug
Browse files Browse the repository at this point in the history
Log client requests and responses
  • Loading branch information
almirmcunhajr authored Jul 3, 2024
2 parents f82a1fc + 97c8720 commit 5b31862
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions azuredevops/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"reflect"
Expand Down Expand Up @@ -124,11 +125,22 @@ func (client *Client) Send(ctx context.Context,
return nil, err
}

log.Println("Sending request", map[string]string{
"URL": req.URL.String(),
"Method": req.Method,
})

resp, err := client.SendRequest(req)
if err != nil {
return nil, err
}

log.Println("Received response", map[string]string{
"URL": resp.Request.URL.String(),
"Method": resp.Request.Method,
"Status": resp.Status,
})

// Set session if one was supplied in the response.
session, ok := resp.Header[headerKeySession]
if ok && len(session) > 0 {
Expand Down

0 comments on commit 5b31862

Please sign in to comment.