Skip to content

fix(api): URL-encode query string values - #184

Merged
Gabrielpanga merged 1 commit into
masterfrom
fix/encode-query-values
Oct 5, 2026
Merged

Gabrielpanga merged 1 commit into
masterfrom
fix/encode-query-values

Conversation

@Gabrielpanga

@Gabrielpanga Gabrielpanga commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

What

mapToQueryString built the query string with raw values (key + '=' + value). Cursor pagination cursors are standard base64 (after on GET /v2/transactions), so they can contain +, / and =. An unencoded + is decoded by the server as a space, so the cursor no longer decodes: fetchTransactionsCursor with after, and fetchAllTransactions past the first page, fail intermittently, only on pages whose cursor happens to contain a +.

Every value (and key) is now passed through encodeURIComponent. Array values are encoded item by item and joined with a literal comma, so list params such as ids are sent exactly as before. No caller pre-encoded values, so nothing gets double-encoded.

Tests

Two tests in tests/transactions.test.ts: a cursor containing +, / and == reaches the API intact (this one fails on master and passes with the fix), and ids stays comma-separated. pnpm test: 62/62.

Note

Stacked on #183 (merge #183 first; GitHub then retargets this PR to master). #185 is stacked on this one.

Base automatically changed from feat/cc-metadata-bill-post-date to master October 5, 2026 13:08
mapToQueryString concatenated raw values. Cursors are base64, so they
carry '+', '/' and '='; an unencoded '+' reaches the server as a space
and the cursor no longer decodes, which breaks fetchTransactionsCursor
and fetchAllTransactions on the pages whose cursor has one. Array values
are still sent comma-separated.
@Gabrielpanga
Gabrielpanga force-pushed the fix/encode-query-values branch from 8705d5f to 66f5a90 Compare October 5, 2026 13:11
@Gabrielpanga
Gabrielpanga merged commit 16f0596 into master Oct 5, 2026
1 of 2 checks passed
@Gabrielpanga
Gabrielpanga deleted the fix/encode-query-values branch October 5, 2026 13:19
pluggy-github-app Bot pushed a commit that referenced this pull request Oct 8, 2026
# [0.92.0](v0.91.0...v0.92.0) (2026-10-08)

### Bug Fixes

* **api:** URL-encode query string values ([#184](#184)) ([16f0596](16f0596))
* **deps:** patch handlebars, http-cache-semantics and brace-expansion advisories ([#187](#187)) ([0ef8d00](0ef8d00))

### Features

* add Smart Transfer linkedJourney, data consent and source account balance ([#186](#186)) ([c77e1c3](c77e1c3))
* **item:** add fetchItemsCursor and fetchAllItems for GET /v2/items ([#185](#185)) ([7a82811](7a82811))
* sync with the API spec (card metadata, SCR, merchants, category rules, pix-qr, boletos) ([#183](#183)) ([d0f0c86](d0f0c86))
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.

3 participants