Skip to content

fix: encode request query parameters#1461

Open
Haozhenyu123 wants to merge 1 commit into
salahlalami:devfrom
Haozhenyu123:issues/fix-query-parameter-encoding
Open

fix: encode request query parameters#1461
Haozhenyu123 wants to merge 1 commit into
salahlalami:devfrom
Haozhenyu123:issues/fix-query-parameter-encoding

Conversation

@Haozhenyu123

Copy link
Copy Markdown

Summary

Fix frontend query parameter encoding for GET requests.

Search and filter values containing reserved characters such as &, +, and # were previously concatenated directly into URLs, causing the backend to receive truncated or incorrect query parameters. For example, searching for ACME & Sons + Partners #1 was parsed as multiple parameters instead of one search value.

Changes

  • Add a reusable buildQueryString helper based on URLSearchParams
  • Use the helper for filter, search, list, listAll, and summary requests
  • Preserve valid falsy values such as 0 and false while omitting null and undefined
  • Add dependency-free regression tests using Node's built-in test runner

Testing

  • npm test - 3 tests passed
  • npm run build - passed
  • Prettier check for changed files - passed
  • Targeted ESLint check for changed files - passed

Note

The existing npm run lint command fails before linting because .eslintrc.js uses CommonJS while frontend/package.json declares type: module. This pre-existing configuration issue is unrelated to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant