Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Support repeating query string params #36

Open

Description

@jdelight

Is it currently possible to build a request like:

http://my-app.com/?filter=1&filter=2&filter=3

In Django you can use request.query_params.getlist('filter') to return a list of [1,2,3]
However I'm not sure this is supported with the core api clients.

Seems to be because you can only have one filter property in the list of params:

if (field.location === 'query') {
    queryParams[field.name] = params[field.name];
    ...

The each filter is replaced with the next one.

Activity

  1. lovelydinosaur commented on May 9, 2017

    @lovelydinosaur
    Contributor

    Howdy @jdelight! 😄

    Rather than having multiple fields in this case, we want to have a single field, but allow the value of the parameter to be an array, and to handle the array case in the way you describe.

    That's something that'll end up on my todo at some point, tho you're very welcome to take a crack at it first if you fancy.

  2. jdelight commented on May 9, 2017

    @jdelight
    Author

    That makes sense thanks @tomchristie. Will take a look if I can - but got a workaround for now. 😄
    Which involves splitting the comma delimited string.

    But yes, would be nice to figure out where the translation from array to query string param happens and if that's in coreapi or one of the URL helper libs.

  3. ryanolf commented on May 1, 2018

    @ryanolf

    @tomchristie @jdelight I ran into the same issue of needing repeating parameters and have added this feature to my branch. See pull request.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions