Add debug logging of requested URLs
This commit is contained in:
parent
5c70d2cf49
commit
9a1ef814ef
@ -264,14 +264,16 @@ func (api *API) do_http(url string, cursor string, result interface{}) error {
|
||||
|
||||
api.add_authentication_headers(req)
|
||||
|
||||
log.Debug(fmt.Sprintf("GET: %s\n", req.URL.String()))
|
||||
for header := range req.Header {
|
||||
log.Debug(fmt.Sprintf(" %s: %s\n", header, req.Header.Get(header)))
|
||||
}
|
||||
|
||||
resp, err := api.Client.Do(req)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error executing HTTP request:\n %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
for header := range req.Header {
|
||||
log.Debug(fmt.Sprintf(" %s: %s\n", header, req.Header.Get(header)))
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 && resp.StatusCode != 403 {
|
||||
content, err := io.ReadAll(resp.Body)
|
||||
|
Loading…
x
Reference in New Issue
Block a user