Query serializer silently drops empty-string parameters

オープン 初心者向け
#179 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
python
領域
api

調査の方向性

src/browserbase/_qs.py の97-102行目から始め、stringify({"q": ""}) で問題を再現してください。ブール値、配列、ネストを対象とする既存の query-string テストを読み、スカラーの空文字列についてのテストを追加して、結果が q= になることを確認してください。一方で、意図的に存在しない値は引き続き省略されるようにします。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
93
フォーク
16
平均マージ
11分
マージ済み PR(30日)
3

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

browserbase/sdk-python のほかの issue

browserbase/sdk-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。