details
This commit is contained in:
		
							parent
							
								
									526c74ad21
								
							
						
					
					
						commit
						45e36d9254
					
				@ -114,6 +114,7 @@ type response struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func getProps(r *response, status string) *props {
 | 
					func getProps(r *response, status string) *props {
 | 
				
			||||||
 | 
						log.Printf("getProps()")
 | 
				
			||||||
	for _, prop := range r.Props {
 | 
						for _, prop := range r.Props {
 | 
				
			||||||
		if strings.Contains(prop.Status, status) {
 | 
							if strings.Contains(prop.Status, status) {
 | 
				
			||||||
			return &prop
 | 
								return &prop
 | 
				
			||||||
 | 
				
			|||||||
@ -17,16 +17,19 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R
 | 
				
			|||||||
	defer auth.Close()
 | 
						defer auth.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for { // TODO auth.continue() strategy(true|n times|until)?
 | 
						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 {
 | 
							if r, err = http.NewRequest(method, uri, body); err != nil {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							log.Printf("Client.req(%s, %s) : Adding headers", method, path)
 | 
				
			||||||
		for k, vals := range c.headers {
 | 
							for k, vals := range c.headers {
 | 
				
			||||||
			for _, v := range vals {
 | 
								for _, v := range vals {
 | 
				
			||||||
				r.Header.Add(k, v)
 | 
									r.Header.Add(k, v)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							log.Printf("Client.req(%s, %s) : Authorize", method, path)
 | 
				
			||||||
		if err = auth.Authorize(c.c, r, path); err != nil {
 | 
							if err = auth.Authorize(c.c, r, path); err != nil {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -39,10 +42,12 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R
 | 
				
			|||||||
			c.interceptor(method, r)
 | 
								c.interceptor(method, r)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							log.Printf("Client.req(%s, %s) : Do", method, path)
 | 
				
			||||||
		if rs, err = c.c.Do(r); err != nil {
 | 
							if rs, err = c.c.Do(r); err != nil {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							log.Printf("Client.req(%s, %s) : Verify", method, path)
 | 
				
			||||||
		if redo, err = auth.Verify(c.c, rs, path); err != nil {
 | 
							if redo, err = auth.Verify(c.c, rs, path); err != nil {
 | 
				
			||||||
			rs.Body.Close()
 | 
								rs.Body.Close()
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
@ -57,6 +62,8 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R
 | 
				
			|||||||
		break
 | 
							break
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						log.Printf("Client.req(%s, %s) : done", method, path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return rs, err
 | 
						return rs, err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user