Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

#49 Updated TODO and func doco #51

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion clients/rest/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const (
)

// Request struct holds the http Request for the rest client
// TODO Add multipart implementation
type Request struct {
url string
method string
Expand Down
6 changes: 5 additions & 1 deletion clients/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
proxyAuthHdr = "Proxy-Authorization"
)

// TODO Add certificate
//Client Object
type Client struct {
retryInfo *clients.RetryInfo
circuitBreaker *clients.CircuitBreaker
Expand Down Expand Up @@ -127,6 +127,8 @@ func (c *Client) SetProxy(proxyUrl, user, password string) (err error) {
return
}

//SetCACerts can take a list of caFilePaths and will add it as the x509 CertPool to the *tls.Config.RootCAs
//The Order of addition is same as the order as they are presented in the paramter
func (c *Client) SetCACerts(caFilePath ...string) (*Client, error) {
conf, err := c.setTlSConfig()
if err != nil {
Expand All @@ -146,6 +148,7 @@ func (c *Client) SetCACerts(caFilePath ...string) (*Client, error) {
return c, nil
}

//SetTLSCerts will set a list of client certificate ket pair.
func (c *Client) SetTLSCerts(certs ...tls.Certificate) (*Client, error) {
conf, err := c.setTlSConfig()
if err != nil {
Expand All @@ -167,6 +170,7 @@ func (c *Client) setSSL(conf *tls.Config) {
c.httpTransport = transport
}

//UseEnvProxy will ensure that the proxy settings are loaded using ENV parameters.
func (c *Client) UseEnvProxy(urlParam, userParam, passwdParam string) (err error) {
u := config.GetEnvAsString(urlParam, textutils.EmptyStr)
user := config.GetEnvAsString(userParam, textutils.EmptyStr)
Expand Down