diff --git a/pkg/httpclient/client.go b/pkg/httpclient/client.go index c2c2c085..95598b11 100644 --- a/pkg/httpclient/client.go +++ b/pkg/httpclient/client.go @@ -14,6 +14,7 @@ import ( type IHttpClient interface { Do(req *http.Request) (*http.Response, error) Get(url string) (*http.Response, error) + Post(url, contentType string, body io.Reader) (resp *http.Response, err error) } // Client special http client that can throttle requests per seconds (RPS). @@ -80,6 +81,15 @@ func (c *Client) incrRPS() { } } +func (c *Client) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) { + req, err := http.NewRequest(http.MethodPost, url, body) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", contentType) + return c.do(req) +} + func (c *Client) Get(url string) (*http.Response, error) { return c.get(url) }