Skip to content

Fix: filter null and undefined params from VK API calls#4

Open
sergiygoncharov wants to merge 1 commit into
bulatko:masterfrom
sergiygoncharov:fix/filter-null-params
Open

Fix: filter null and undefined params from VK API calls#4
sergiygoncharov wants to merge 1 commit into
bulatko:masterfrom
sergiygoncharov:fix/filter-null-params

Conversation

@sergiygoncharov

Copy link
Copy Markdown

Problem

Optional parameters with null or undefined values were being serialized as literal strings "null" / "undefined" in URLSearchParams, causing unexpected VK API errors.

Solution

Filter out null and undefined entries before building the request body in VKClient.call().

const clean = Object.fromEntries(
  Object.entries(params).filter(([, v]) => v !== undefined && v !== null)
);

Test plan

  • Verified that optional params (e.g. offset, count, city) are correctly omitted when not provided
  • All existing tools continue to work after the fix

🤖 Generated with Claude Code

Previously, null/undefined optional params were serialized as literal
strings "null"/"undefined" in URLSearchParams, causing VK API errors.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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