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

fix(openapi-fetch): Prevent orphan ampersands in query from empty arrays #1936

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

BlakeSzabo
Copy link
Contributor

Changes

Fixes a case where multiple empty arrays are passed as query params will create multiple orphaned ampersands in the resultant request URL

Closes #1935

How to Review

I decided to effectively ignore empty arrays in the querySerializer, the issue was they were returning "" from seralizeArrayParam which was then caught up in the .join("&"). However, we could just as easily .filter out the empty strings and catch for the general case.

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

@BlakeSzabo BlakeSzabo requested a review from a team as a code owner October 1, 2024 23:50
Copy link

changeset-bot bot commented Oct 1, 2024

🦋 Changeset detected

Latest commit: 4f9d2f3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
openapi-fetch Patch
openapi-react-query Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kerwanp kerwanp added the openapi-fetch Relevant to the openapi-fetch library label Oct 14, 2024
Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful, thank you!! 💯 No feedback, great tests 🙂

@drwpow drwpow merged commit d14aa65 into openapi-ts:main Oct 25, 2024
8 checks passed
@github-actions github-actions bot mentioned this pull request Oct 25, 2024
Dafnik added a commit to Dafnik/dfts-common that referenced this pull request Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openapi-fetch Relevant to the openapi-fetch library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple query parameter empty arrays append orphaned ampersands to query string
3 participants