Skip to content

Request params Optional<List<String> and List<String> are inconsistent [SPR-15676] #20235

Closed

Description

@spring-projects-issues

Ayush Kumar opened SPR-15676 and commented

When using List<String> as the request parameter, both key=val1,val2 and key=val1&key=val2 end up mapping to key = [val1, val2]

When using Optional<List<String>> as the request parameter
key=val1,val2 maps to key = Optional([val1,val2])
but key=val1&key=val2 maps to Optional([val1])

This makes RequestParam(..., required = false) List<String> behave differently from RequestParam(...) Optional<List<String>>, which seems unfortunate.


Affects: 4.3.4

Issue Links:

Backported to: 4.3.12

1 votes, 3 watchers

Activity

  1. spring-projects-issues commented on Jun 16, 2017

    @spring-projects-issues
    CollaboratorAuthor

    Ayush Kumar commented

    Linked to #17997

  2. spring-projects-issues commented on Sep 20, 2017

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    This turns out to be addressed by the fix for #20473. I've added dedicated tests for regular parameter values as well now.

  3. added
    type: bug
    status: backported
    in: web
    on Jan 11, 2019
  4. added this to the 5.0 GA milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webstatus: backportedtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions