Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted full URL construction logic in integration #246

Merged
merged 2 commits into from
Jun 20, 2024
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
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
Loading