We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5753e4 commit 7ee7fb2Copy full SHA for 7ee7fb2
option/requestoption.go
@@ -37,14 +37,15 @@ func WithAPIVersion(value string) RequestOption {
37
// For security reasons, ensure that the base URL is trusted.
38
func WithBaseURL(base string) RequestOption {
39
u, err := url.Parse(base)
40
+ if err == nil && u.Path != "" && !strings.HasSuffix(u.Path, "/") {
41
+ u.Path += "/"
42
+ }
43
+
44
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
45
if err != nil {
- return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s\n", err)
46
+ return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s", err)
47
}
48
- if u.Path != "" && !strings.HasSuffix(u.Path, "/") {
- u.Path += "/"
- }
49
r.BaseURL = u
50
return nil
51
})
0 commit comments