Query serializer silently drops empty-string parameters
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start in src/browserbase/_qs.py at lines 97-102 and reproduce the issue with stringify({"q": ""}). Read the existing query-string tests covering booleans, arrays, and nesting, then add coverage for scalar empty strings and confirm the result is q= while intentionally absent values remain omitted.
Written by the indexing model from the issue text.
Description
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:
'q='
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.
- Dominant language
- Python
- Stars
- 93
- Forks
- 16
- Avg merge
- 11m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from browserbase/sdk-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
browserbase/sdk-python#182 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
browserbase/sdk-python#180 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
browserbase/sdk-python#178 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
browserbase/sdk-python#176 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
browserbase/sdk-python#175 ·
All issues in browserbase/sdk-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100