(cfs ...ClientFunc)
| 94 | } |
| 95 | |
| 96 | func New(cfs ...ClientFunc) *Client { |
| 97 | userAgent := UserAgent |
| 98 | if config.ChartVersion() != "" { |
| 99 | userAgent = fmt.Sprintf(fmt.Sprintf("%s/%s", UserAgent, config.ChartVersion())) |
| 100 | } |
| 101 | |
| 102 | r := resty.New() |
| 103 | r.SetHeader("Content-Type", "application/json"). |
| 104 | SetHeader("Accept", "application/json"). |
| 105 | SetHeader("User-Agent", userAgent). |
| 106 | SetTimeout(TimeoutSeconds * time.Second). |
| 107 | SetLogger(log.SugaredLogger()) |
| 108 | |
| 109 | c := &Client{ |
| 110 | Client: r, |
| 111 | IgnoreCodes: sets.NewInt(), |
| 112 | } |
| 113 | |
| 114 | for _, cf := range cfs { |
| 115 | cf(c) |
| 116 | } |
| 117 | |
| 118 | return c |
| 119 | } |
| 120 | |
| 121 | func (c *Client) Get(url string, rfs ...RequestFunc) (*resty.Response, error) { |
| 122 | return c.Request(resty.MethodGet, url, rfs...) |
no test coverage detected