Skip to content

Commit

Permalink
Log client requests and responses
Browse files Browse the repository at this point in the history
  • Loading branch information
almirmcunhajr committed Jul 3, 2024
1 parent f82a1fc commit accd8d9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 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,21 @@ 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(),
"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 accd8d9

Please sign in to comment.