Query serializer silently drops empty-string parameters

Aperta Adatta ai principianti
#179 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
api

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di browserbase/sdk-python

Tutte le issue di browserbase/sdk-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.