update
							parent
							
								
									43799a9841
								
							
						
					
					
						commit
						af5fef67db
					
				| 
						 | 
					@ -324,8 +324,12 @@ func (r *Request) doRequest(timeout time.Duration, method, rawUrl string) (*Resp
 | 
				
			||||||
	copy(body, tmpBody)
 | 
						copy(body, tmpBody)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if r.httpClient.config.noCheckStatus == false {
 | 
						if r.httpClient.config.noCheckStatus == false {
 | 
				
			||||||
		if resp.StatusCode() != http.StatusOK {
 | 
							if resp.StatusCode() >= 400 {
 | 
				
			||||||
			return nil, fmt.Errorf("status code err: %d (%s)", resp.StatusCode(), body)
 | 
								return nil, &StatusErr{
 | 
				
			||||||
 | 
									StatusCode: resp.StatusCode(),
 | 
				
			||||||
 | 
									Body:       body,
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								//return nil, fmt.Errorf("status code err: %d (%s)", resp.StatusCode(), body)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -364,3 +368,14 @@ type Response struct {
 | 
				
			||||||
func (r *Response) GetBody() []byte {
 | 
					func (r *Response) GetBody() []byte {
 | 
				
			||||||
	return r.body
 | 
						return r.body
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var _ error = (*StatusErr)(nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type StatusErr struct {
 | 
				
			||||||
 | 
						StatusCode int
 | 
				
			||||||
 | 
						Body       []byte
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s *StatusErr) Error() string {
 | 
				
			||||||
 | 
						return fmt.Sprintf("status code err: %d (%s)", s.StatusCode, s.Body)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue