Skip to content
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

Aliased slices should be consistent with builtin slices #2602

Closed

Commits on Mar 1, 2024

  1. Aliased slices should be consistent with builtin slices

    In working with an API at work we had the use case on query params to accept the
    following syntaxes:
    
    - `?foo=1&foo=2&foo=3`
    - `?foo=1,2,3`
    
    Initially we were using only the former syntax, but then a new library was
    developed that sent the latter syntax.  When we switched from defining our field
    as `[]int` to a custom type `Ints` that implemented `UnmarshalParam` we found
    that when there were multiple values for the same key, the `UnmarshalParam`
    would only receive the first value and others would be lost.
    
    This change brings
    consistency between the builtin slices and the aliased slices for query
    parameters.
    Brandon Hansen committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    04cd714 View commit details
    Browse the repository at this point in the history
  2. add test for aliased int array

    Brandon Hansen committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    5a728de View commit details
    Browse the repository at this point in the history
  3. add test coverage for handling errors

    Brandon Hansen committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    84fc44e View commit details
    Browse the repository at this point in the history