details
This commit is contained in:
parent
526c74ad21
commit
45e36d9254
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user