Skip to content

Support multiply query ResourceParameters with same name #63

Closed

Description

@btittelbach

Is your feature request related to a problem? Please describe.
There is currently now way to parse values for multiple parameters with the same key-name.
e.g. a valid query string could be: ?ctrarray=1&ctrarray=2&ctrarray=3&ctrarray=4 ... and getRequestParameter would always only return the first occurrence of the parameter.
This also occurs in POST forms where there are multiple input fields with the same name. e.g. when it's possible to enter multiple data rows with the same fields.
e.g.:

<form method="POST">
<input type="text" name="ssid"><input type="text" name="pass"><br/>
<input type="text" name="ssid"><input type="text" name="pass"><br/>
<input type="text" name="ssid"><input type="text" name="pass"><br/>
<button onClick="javascript:...">Add A Line</button>
</form>

Describe the solution you'd like
This is sometimes used in the wild and can be useful in bare-bone microcontroller webpage environments. Most frameworks support it. It would thus be useful to iterate over the request parameters.

Describe alternatives you've considered
Not supporting this, since most people hopefully won't need to parse queries like this.

Activity

  1. changed the title [-]Support full standard of query ResourceParameters[/-] [+]Support multiply query ResourceParameters with same name[/+] on Dec 2, 2019
  2. fhessel commented on Dec 3, 2019

    @fhessel
    Owner

    Do you know anything more current/more official on this topic than what's discussed in this answer on StackOverflow?

    Returning a collection of strings from getRequestParameter would make processing the request parameters more complicated in most cases (at least that's what I'd assume), where this is not needed, and if the specification does not cover the way this should be handled, I'd not make the API more complicated than that.

    Maybe it would be a solution to include the duplicate parameters when using the iterator from #62 to go through the request parameters? In that case the user can decide if duplicate values are relevant and define how they should be handled.

  3. btittelbach commented on Dec 3, 2019

    @btittelbach
    Author

    Nothing more authoritative that that. As it says, there does not seem to be a standard, thus everything that the schema allows is used somewhere, including the use of multiple identical keys. I know that a decade ago already some frameworks would translate array data to request-data in this form.

    I think that mostly this will not be needed, so just including them in the iterator from #62 should be perfectly fine.

  4. added 2 commits that reference this issue on Dec 5, 2019
    11f1589
    2f50357
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions