Skip to content

fix(Network): store empty string for query params without values - #729

Merged
Maizify merged 1 commit into
Tencent:devfrom
hobostay:fix/empty-query-param-value
Mar 16, 2026
Merged

fix(Network): store empty string for query params without values#729
Maizify merged 1 commit into
Tencent:devfrom
hobostay:fix/empty-query-param-value

Conversation

@hobostay

@hobostay hobostay commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix query parameter parsing to store empty string instead of 'undefined' for params without values
  • Affects genFormattedBody in helper.ts

Bug Description

When parsing URL query strings like a=1&c, parameters without values (like c) were being stored with the literal string 'undefined' instead of an empty string.

Example:

  • Input: a=1&c
  • Before: { a: '1', c: 'undefined' }
  • After: { a: '1', c: '' }

This is inconsistent with standard URL parameter handling where c and c= are typically treated the same way (both representing a parameter with an empty value).

Fix

Changed the ternary operator in genFormattedBody to return an empty string ('') instead of the literal string 'undefined' when kv[1] is undefined.

Test Plan

  • Make a request with query parameters that have no value (e.g., ?a=1&c)
  • Open vConsole Network tab
  • View the request's Query String Parameters
  • Verify that parameter c shows an empty string instead of 'undefined'

Related Issues

Improves network request inspection accuracy.

When parsing URL query strings like 'a=1&c', parameters without values
(e.g., 'c') were being stored with the literal string 'undefined' instead
of an empty string. This fixes the behavior to store an empty string for
parameters that have no value.

For example:
- Before: { a: '1', c: 'undefined' }
- After: { a: '1', c: '' }

This aligns better with standard URL parameter handling where 'c' and 'c='
are typically treated the same way.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tencent-adm

tencent-adm commented Mar 14, 2026

Copy link
Copy Markdown
Member

CLA assistant check
All committers have signed the CLA.

@Maizify
Maizify merged commit dc5886f into Tencent:dev Mar 16, 2026
2 checks passed
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