-
Notifications
You must be signed in to change notification settings - Fork 17
Support duplicate keys in Query
#129
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
Comments
Additional options:
|
I like the proposal to use a I'd suggest before getting too deep into implementation, take a look at this example and open the PR with the changes to that example that would be necessary for your proposal (including extending it to use multiple values for the same parameter) so we can discuss on sample code. Regarding |
Thanks for suggestions!
I think that it is not equivalent because
I think that we should provide original uri because uri RFC doesn't say anything specific about the shape of for example |
Ok, those are good points, I've opened #130 to track exposing the original request URL. |
I have additional design question. |
Yeah, I like that proposal. Let's split out a separate issue to track determining the right API to expose and implementing it |
As a first step I've added additional tests for query parsing which are failing in the current implementation: Do you agree that we don't want to parse single equal sign as correct key definition or should we treat it as a
|
I am leaning towards following what Express does here, which is to ignore the empty const express = require('express');
const app = express();
app.get('/', (req, res) => res.send(req.query));
app.listen(3000, () => console.log('App up')); $ curl "localhost:3000?foo=bar&="
{"foo":"bar"} This isn't something I feel particularly strongly about and I can be convinced otherwise, but I tend to think that httpure should follow express conventions for this kind of thing. |
There are multiple issuess with current
Query
representation:fullPath
- doesn't return original value of uri. We are not able to call it "equivalent" from my perspecitve,We are trying to start using HTTPure not only for API based endpoints and we want to be able to receive data from standard
HTML
forms.HTML
allows you to send multiple values for single querykey
(like with<select multiple name="key">
) and it is quite common to build group of checkboxes with the same key too as multichoice widget.I have two propositions assuming that we don't want to support empty values (like
key1&key2
):type Query = Array (Tuple String String)
with additional helper which converts this toMap
type Query = Map String (Array String)
We are ready to work on this and provide a PR.
The text was updated successfully, but these errors were encountered: