-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
SetQueryParams with collection of KV pairs, duplicate keys should append, not overwrite #370
Comments
It seems to be a breaking changes. Could you please advise if you wanna replace that logic or add some parameter for that? Then I'll try to prepare PR. Thx |
@Marusyk Sometimes it's a fine line between a breaking change and fixing some unintended behavior seems "obviously" quirky/buggy. I logged this because I bumped into it in a real-world scenario and it seemed "obviously" wrong, but I'm now wondering if the likelihood of breaking someone is higher than I thought. Tough call. Keep in mind this DOES overwrite, which is intentional and won't change: url
.SetQueryParam("x", 1)
.SetQueryParam("x", 2); I intentionally used the word "Set" instead of "Add" or "Append" here to help make it clear that you're providing the entire value so go ahead and squash whatever might already be there. If you want The scenario in this issue is more unusual. If you use |
In the case where all the values are passed in the single set method and squashed, it seems like an obvious bug to be patched. |
I was hoping I could piggyback off existing code to fix this but it's a little trickier than I thought. I'm considering adding |
Although I still think this seems like an obvious quirk, now that I'm pushing it out to 4.0 I'll play it safe and call it breaking. #688 will be a prerequisite. |
Now available in prerelease 4 https://www.nuget.org/packages/Flurl/4.0.0-pre4 |
Flurl allows setting multiple query parameters via object notation, with special handling for things that look like collections of key/value pairs. It's possible that these collections could contain duplicate keys, and in this case every value should be appended. Instead they get overwritten each time, so this test fails:
In a nutshell, that should pass.
The text was updated successfully, but these errors were encountered: