Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

URIBuilder.extend_query_with drops existing parameters that have an empty value

未关闭 适合新手
#164 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
86/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

从 URIBuilder.extend_query_with 开始,检查其对 urllib.parse.parse_qsl 的使用;issue 指出空值处理会丢弃已有的 query 对。添加回归测试,分别测试用一个键值对和一个空列表扩展 a=,然后运行与 URIBuilder 相关的测试。两种情况下,结果 query 中都保留 a= 即为完成。

由索引模型根据 Issue 内容生成。

描述

>>> from rfc3986.builder import URIBuilder
>>> URIBuilder(query="a=").extend_query_with([("b", "c")]).query
'b=c'            # expected 'a=&b=c'
>>> URIBuilder(query="a=").extend_query_with([]).query
''               # expected 'a='

extend_query_with re-parses the existing query with urllib.parse.parse_qsl(self.query or ""), whose default keep_blank_values=False silently drops every pair with an empty value, so extending a query can lose parameters that were there before. a= and a are meaningful to many servers (presence of a flag), and the docstring describes the method as extending the existing query, not filtering it.

Reproduced on 2.0.0 (main 3bd3832). The fix is parse_qsl(self.query or "", keep_blank_values=True). Happy to send a PR with a test if you would take one.

主要语言
Python
星标
189
派生
43
平均合并
12 小时 14 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

python-hyper/rfc3986 的其他 Issue

查看 python-hyper/rfc3986 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。