-
Notifications
You must be signed in to change notification settings - Fork 722
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
Retry duplicates query parameters in v3.0.0-alpha.6 #938
Comments
This even still occurs with the following func retryHook(resp *resty.Response, err error) {
var changed bool
var params map[string][]string
if resp.Request.QueryParams != nil {
params = resp.Request.QueryParams
for k, v := range params {
if len(v) > 1 {
changed = true
slices.Sort(params[k])
params[k] = slices.Compact(params[k])
}
}
if changed {
// Either of these makes no difference in behavior.
//resp.Request.QueryParams = params
resp.Request.SetQueryParamsFromValues(params)
}
// resp.Request.SetQueryParams()
}
} and also still occurs regardless of if |
@nf-brentsaner Thanks for reaching out. I have looked at it and tried the above code snippet, which does not help me to replicate the issue. Then I have created a test case to try it on v2 and v3. func TestRetryQueryParamsGH938(t *testing.T) {
ts := createGetServer(t)
defer ts.Close()
c := New().
SetBaseURL(ts.URL).
SetRetryCount(5).
AddRetryCondition(
func(r *Response, _ error) bool {
fmt.Println(r.Request.URL)
fmt.Println(r.Request.RawRequest.URL.String())
return true
},
)
_, _ = c.R().
SetQueryParamsFromValues(map[string][]string{
"foo": {
"baz",
"bar",
"bar",
},
}).
Get("/set-retrycount-test")
} I was able to replicate the issue in |
Oddly... I actually switched to/tried v3 because I was hoping this issue wasn't present in it. But you're right, confirmed! I now cannot reproduce in v2, though I could have sworn I originally was. I'll edit the original message to indicate it's v3 only. |
@nf-brentsaner Thanks for the confirmation. I will look into the v3 bug. |
This occurs on v3.
POC:
The text was updated successfully, but these errors were encountered: