-
Notifications
You must be signed in to change notification settings - Fork 183
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
add support for duplicate query param keys #433
Conversation
acdupont
commented
Jul 22, 2019
- Store values for duplicate keys in array
- Add two tests for parsing duplicate query param keys
- Tests pass with same behavior as prior to adding the tests (server.jl tests sometimes hang)
Codecov Report
@@ Coverage Diff @@
## master #433 +/- ##
==========================================
- Coverage 73.59% 73.34% -0.26%
==========================================
Files 34 34
Lines 1909 1917 +8
==========================================
+ Hits 1405 1406 +1
- Misses 504 511 +7
Continue to review full report at Codecov.
|
@acdupont, sorry for the slow review on this. I do think we should handle the case of parsing duplicate keys. I just want to make sure we have a quick discussion on the best solution here, options include:
@oxinabox @omus @ararslan @randyzwitch , do you all have any opinions on the best way forward here? We could also manage the breaking situations with various plans: introduce a new function that handles the duplicate keys while leaving |
We should not fear breaking. I lean towards option two.
On the other hand, some frameworks deem this various kinds of illegal, On that basis, I don't hate 3. |
I lean towards option 2 as well. I wrote the code for this PR to have as little impact as possible, but returning the same type no matter how many parameters there are is less surprising. I would expect Option 3 to cause frustrating problems in calling code because places where one |
FWIW I kinda like 3 since that is how I specify duplicate keys when passing them to HTTP.jl. But maybe the other options also roundtrips? |
This is a hard one. Perhaps option #4... you have two functions. One that always returns a vector (or should it be a tuple?), the other that always returns a string. The one that always returns a string raise an exception if there there is not exactly one value; if the parameter is missing or the parameter is specified twice, it becomes an error. Alternatively, if you always return a tuple, someone could write the one that asserts a single value in user-land. I guess option #2 as |
This code has now been moved to URIs.jl. See also URIs.jl#30. |