-
Notifications
You must be signed in to change notification settings - Fork 6
chore(RDGRS-1371): add new flow layer #132
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
base: main
Are you sure you want to change the base?
Conversation
OS-kiranmalsetty
commented
May 6, 2025
•
edited
Loading
edited
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) ✅ code/snyk check is complete. No issues have been found. (View Details) |
main.go
Outdated
@@ -150,7 +153,12 @@ func client(args []string) { | |||
|
|||
queryParams := generateQueryParameters(localPorts) | |||
|
|||
config.Server = fmt.Sprintf("%s%s", args[0], queryParams) | |||
//get server URL | |||
restyclient := resty.New() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not inside the func getURL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created the client outside the getURL to test the function with the mocked client.
main.go
Outdated
//get server URL | ||
restyclient := resty.New() | ||
//httpClient := &http.Client{} | ||
ServerURL := getURL(restyclient, args[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServerURL
, why upper case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be a typo. Fixed it.
main.go
Outdated
@@ -180,6 +188,36 @@ func client(args []string) { | |||
} | |||
} | |||
|
|||
func getURL(client *resty.Client, requestLocation string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getURL
it's not the best name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any suggestions for the name?
main.go
Outdated
} | ||
|
||
// Ensure the URL has a valid scheme | ||
if parsedURL.Scheme != "http" && parsedURL.Scheme != "https" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a scheme should be allowed, like localhost:8080
|
||
resp, err := client.SetDoNotParseResponse(true).R().Get(parsedURL.String()) | ||
if err != nil { | ||
if resp != nil && resp.StatusCode() == http.StatusFound { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why validate if resp != nil
twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resp and err are different fields. I want to check the response only when there is an error.