From 45e36d9254febeaf6328b70e74d21fdfa48991d3 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 20 Jan 2024 12:11:08 +0100 Subject: [PATCH] details --- client.go | 1 + requests.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/client.go b/client.go index c53e591..091d048 100644 --- a/client.go +++ b/client.go @@ -114,6 +114,7 @@ type response struct { } func getProps(r *response, status string) *props { + log.Printf("getProps()") for _, prop := range r.Props { if strings.Contains(prop.Status, status) { return &prop diff --git a/requests.go b/requests.go index 1ec6195..37a728c 100644 --- a/requests.go +++ b/requests.go @@ -17,16 +17,19 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R defer auth.Close() for { // TODO auth.continue() strategy(true|n times|until)? + log.Printf("Client.req(%s, %s) : NewRequest", method, path) if r, err = http.NewRequest(method, uri, body); err != nil { return } + log.Printf("Client.req(%s, %s) : Adding headers", method, path) for k, vals := range c.headers { for _, v := range vals { r.Header.Add(k, v) } } + log.Printf("Client.req(%s, %s) : Authorize", method, path) if err = auth.Authorize(c.c, r, path); err != nil { return } @@ -39,10 +42,12 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R c.interceptor(method, r) } + log.Printf("Client.req(%s, %s) : Do", method, path) if rs, err = c.c.Do(r); err != nil { return } + log.Printf("Client.req(%s, %s) : Verify", method, path) if redo, err = auth.Verify(c.c, rs, path); err != nil { rs.Body.Close() return nil, err @@ -57,6 +62,8 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R break } + log.Printf("Client.req(%s, %s) : done", method, path) + return rs, err }