Search code examples
scalaplayframeworkapi-design

Is it possible pass in same request parameter multiple times in Play and Scala


Can I pass in the same request parameter multiple times in Play? From the documentation it seems that request.queryString returns a map but I'm not sure how it handles duplicate param keys.

For example, to search for photos that have both John and Sarah:

/photo?member=John&member=Sarah


Solution

  • No, you can't, only first occurrence will be taken into account.

    Anyway you can for an instance use comma separated list of params like:

    /photo?members=John,Sarah
    

    and then split() it to the String array by comma character.