Description
The query serializer drops scalar empty-string values instead of encoding them as an empty query parameter. _primitive_value_to_str("") returns "", then _stringify_item treats the serialized value as falsy and returns no item.
Code reference
src/browserbase/_qs.py:97-102
Reproduction
from browserbase._qs import stringify
print(repr(stringify({"q": ""})))
Actual:
Expected:
The behavior is also inconsistent with a comma-formatted empty list/all-None list, which can retain the key with an empty value.
Expected behavior
Only values intentionally treated as absent should be omitted. A supplied empty string should serialize as key= so generated endpoints and extra_query can distinguish an empty value from a missing parameter.
Why it matters
Some APIs use the distinction between a missing query key and a present-but-empty key. The SDK's documented custom/undocumented request support cannot currently express the latter through normal query options. Existing query-string tests cover booleans, arrays, and nesting, but not empty scalar values.
Description
The query serializer drops scalar empty-string values instead of encoding them as an empty query parameter.
_primitive_value_to_str("")returns"", then_stringify_itemtreats the serialized value as falsy and returns no item.Code reference
src/browserbase/_qs.py:97-102Reproduction
Actual:
''Expected:
'q='The behavior is also inconsistent with a comma-formatted empty list/all-
Nonelist, which can retain the key with an empty value.Expected behavior
Only values intentionally treated as absent should be omitted. A supplied empty string should serialize as
key=so generated endpoints andextra_querycan distinguish an empty value from a missing parameter.Why it matters
Some APIs use the distinction between a missing query key and a present-but-empty key. The SDK's documented custom/undocumented request support cannot currently express the latter through normal query options. Existing query-string tests cover booleans, arrays, and nesting, but not empty scalar values.