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 7c466c2 commit aa5fbb8Copy full SHA for aa5fbb8
option/requestoption.go
@@ -27,14 +27,15 @@ type RequestOption = requestconfig.RequestOption
27
// For security reasons, ensure that the base URL is trusted.
28
func WithBaseURL(base string) RequestOption {
29
u, err := url.Parse(base)
30
+ if err == nil && u.Path != "" && !strings.HasSuffix(u.Path, "/") {
31
+ u.Path += "/"
32
+ }
33
+
34
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
35
if err != nil {
- return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s\n", err)
36
+ return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s", err)
37
}
38
- if u.Path != "" && !strings.HasSuffix(u.Path, "/") {
- u.Path += "/"
- }
39
r.BaseURL = u
40
return nil
41
})
0 commit comments