Skip to content

Add config option for Query Params With Arrays issue. #60

@DexterHill0

Description

@DexterHill0

I see that issue #56 has been resolved, which changed the format of arrays in query parameter from foo=a,b,c to foo=a&foo=b&foo=c. This isn't inherently wrong, however (from what I can tell and have seen) there isn't a defined standard for this, and in fact an API I am currently working with uses the former comma-separated syntax instead. By changing from one to the other, this will inevitably be a breaking change for those who use the comma-separated format.

Instead of constantly going back-and-forth supporting just one of the two formats, I propose an extra config option to allow the user to choose what format they want the arrays to be serialized. Not only does this mean both can be supported, other syntaxes could be supported in the future (for example, I have also seen arrays formatted like foo[]=a&foo[]=b, and so on). It would default to the comma-separated behaviour, to make it a non-breaking change, but could be set to the other format where applicable.

I would be happy to PR this if necessary.

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