Skip to content

Commit

Permalink
Merge pull request #246 from deploymenttheory/dev-jl-version2
Browse files Browse the repository at this point in the history
Adjusted full URL construction logic in integration
  • Loading branch information
thejoeker12 authored Jun 20, 2024
2 parents f1fdb0b + 81015de commit 1eb0f9a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion httpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func BuildClient(config ClientConfig, populateDefaultValues bool, log logger.Log
return nil, fmt.Errorf("invalid configuration: %v", err)
}

log.Info(fmt.Sprintf("initializing new http client, auth: %s", config.Integration.Domain()))
log.Info(fmt.Sprintf("initializing new http client, auth: %s", config.Integration.GetFQDN()))

httpClient := &http.Client{
Timeout: config.CustomTimeout,
Expand Down
2 changes: 1 addition & 1 deletion httpclient/cookies.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (c *Client) loadCustomCookies(cookiesList []*http.Cookie) error {
return err
}

cookieUrl, err := url.Parse((*c.Integration).Domain())
cookieUrl, err := url.Parse((*c.Integration).GetFQDN())

if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion httpclient/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (

// TODO comment
type APIIntegration interface {
Domain() string
GetFQDN() string
ConstructURL(endpoint string) string
GetAuthMethodDescriptor() string
CheckRefreshToken() error
PrepRequestParamsAndAuth(req *http.Request) error
Expand Down
2 changes: 1 addition & 1 deletion httpclient/multipartrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *Client) DoMultiPartRequest(method, endpoint string, files map[string][]

log.Info("Executing multipart file upload request", zap.String("method", method), zap.String("endpoint", endpoint))

url := (*c.Integration).Domain() + endpoint
url := (*c.Integration).GetFQDN() + endpoint

// Create a context with timeout based on the custom timeout duration
ctx, cancel := context.WithTimeout(context.Background(), c.config.CustomTimeout)
Expand Down
2 changes: 1 addition & 1 deletion httpclient/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (c *Client) doRequest(ctx context.Context, method, endpoint string, body in
}
requestDataBytes := bytes.NewBuffer(requestData)

url := (*c.Integration).Domain() + endpoint
url := (*c.Integration).ConstructURL(endpoint)

req, err := http.NewRequest(method, url, requestDataBytes)
if err != nil {
Expand Down

0 comments on commit 1eb0f9a

Please sign in to comment.