(reqUrl string, reqParams map[string]string, headers map[string]string)
| 69 | } |
| 70 | |
| 71 | func (target HttpClient) Get(reqUrl string, |
| 72 | reqParams map[string]string, headers map[string]string) (string, error) { |
| 73 | result := "" |
| 74 | var err error = nil |
| 75 | |
| 76 | Retry(target.RetryMax, target.Sleep, func() error { |
| 77 | result, err = target.get(reqUrl, reqParams, headers) |
| 78 | if err == nil { |
| 79 | if result == "" { |
| 80 | err = errors.New("response body is empty") |
| 81 | } else if !IsJSON(result) { |
| 82 | err = errors.New("response body is not json") |
| 83 | } |
| 84 | } |
| 85 | return err |
| 86 | }) |
| 87 | |
| 88 | return result, err |
| 89 | } |
| 90 | |
| 91 | func (target HttpClient) Put(reqUrl string, |
| 92 | reqParams map[string]interface{}, headers map[string]string) (string, error) { |
no test coverage detected