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

feat: parse array query by qs #3751

Merged
merged 4 commits into from May 6, 2024
Merged

feat: parse array query by qs #3751

merged 4 commits into from May 6, 2024

Conversation

czy88840616
Copy link
Member

@czy88840616 czy88840616 commented Apr 7, 2024

Objectives

We want to parse array query parameters in Koa. By default, Koa uses querystring to parse parameters like 'a[]=1', resulting in an object:

{
    "a[0]": 1,
    "a[1]": 2,
}

However, we desire to obtain values in a format similar to koa-qs

{
    "a": [1, 2]
}

@czy88840616 czy88840616 added this to the v3.15.x milestone Apr 7, 2024
@czy88840616 czy88840616 changed the title feat: add qs for parse query with array feat: parse query by qs Apr 7, 2024
@czy88840616 czy88840616 changed the title feat: parse query by qs feat: parse array query by qs Apr 7, 2024
@czy88840616 czy88840616 merged commit ca5a5d6 into main May 6, 2024
7 checks passed
@czy88840616 czy88840616 added the pr: new feature This PR adds a new API or behavior. label May 6, 2024
@czy88840616 czy88840616 deleted the fix_koa_query branch May 6, 2024 14:05
czy88840616 added a commit that referenced this pull request May 10, 2024
* feat: add qs for parse query with array

* fix: lint

* test: add case

(cherry picked from commit ca5a5d6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new feature This PR adds a new API or behavior.
Development

Successfully merging this pull request may close these issues.

None yet

1 participant