Query serializer silently drops empty-string parameters
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia in src/browserbase/_qs.py alle righe 97-102 e riproduci il problema con stringify({"q": ""}). Leggi i test esistenti per query-string che coprono booleani, array e annidamento, quindi aggiungi la copertura per le stringhe vuote scalari e conferma che il risultato sia q=, mentre i valori intenzionalmente assenti continuano a essere omessi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 93
- Fork
- 16
- Merge medio
- 11m
- PR unite (30g)
- 3
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di browserbase/sdk-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
browserbase/sdk-python#182 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
browserbase/sdk-python#180 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
browserbase/sdk-python#178 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
browserbase/sdk-python#176 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
browserbase/sdk-python#175 ·
Tutte le issue di browserbase/sdk-python
Issue simili
-
documentation help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
simonw/sqlite-utils#872 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100