-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feature/refactor request builder #27
Conversation
pkg/internal/httpclient/helper.go
Outdated
return nil | ||
} | ||
|
||
func checkReplaces(pathURL string) error { |
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.
Usando o package regexp
essa função não é necessária:
const pathParamRegexp = regexp.MustCompile(`{[^{}]*}`)
matches := pathParamRegexp.FindAllString(pathURL, -1)
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.
boa, feito!
pkg/internal/httpclient/helper.go
Outdated
pathURL := req.URL.Path | ||
|
||
for k, v := range params { | ||
pathParam := fmt.Sprintf("{%s}", k) |
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.
Só para conhecimento, Sprintf
não tem uma boa performance.
strings.Join
e usar +
é mais performático. Como é uma concatenação bem simlpes acredito que não precisa usar Sprintf
.
pathParam := fmt.Sprintf("{%s}", k) | |
pathParam := "{"+k+"}" |
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.
feito!
Removes options from baseclient, options are not so useful in that case because our baseclient should not have other configurations. This PR merges baseclient content with httpclient already that in our cases they have similar purposes (build request before sent to the Requester implementation).