Skip to content

Commit 5ec43c4

Browse files
fix: prevent duplicate ? in query params
1 parent 91e3a65 commit 5ec43c4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/requestconfig/requestconfig.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,16 @@ func NewRequestConfig(ctx context.Context, method string, u string, body interfa
118118
hasSerializationFunc = true
119119
params := body.URLQuery().Encode()
120120
if params != "" {
121-
u = u + "?" + params
121+
parsed, err := url.Parse(u)
122+
if err != nil {
123+
return nil, err
124+
}
125+
if parsed.RawQuery != "" {
126+
parsed.RawQuery = parsed.RawQuery + "&" + params
127+
u = parsed.String()
128+
} else {
129+
u = u + "?" + params
130+
}
122131
}
123132
}
124133
if body, ok := body.([]byte); ok {

0 commit comments

Comments
 (0)