Generated multipart curl doesn't escape characters of form data fields
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- tooling
调研方向
首先定位生成 multipart curl 代码片段的 TypeScript 代码,并复现所示 XML 字段的大小写。更新生成的 form-data 参数,使其中嵌入的引号字符进行转义,然后验证生成的 curl 请求是否成功;如果 repository 中有相关测试,则添加或更新覆盖率。
由索引模型根据 Issue 内容生成。
描述
Related with https://github.com/Kong/insomnia/issues/3868
As of now we are not escaping double-quote characters that are in data fields of curl requests. This causes the curl request to fail.
Example generated curl:
curl --request GET \
--url http://mockbin.org/request/anything \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form timestamp=2022-05-10T10:04:18.748Z \
--form field=test \
--form 'data=<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<test>TEST<test>'
This doesn't seem to be the case for example for Python, where we escape characters we need to, and the request works fine:
import requests
url = "http://mockbin.org/request/anything"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp\"\r\n\r\n2022-05-10T10:07:25.650Z\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"field\"\r\n\r\ntest\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<test>TEST<test>\r\n-----011000010111000001101001--\r\n"
headers = {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text)
Example postman generated curl:
curl --location --request POST 'https://test.com' \
--form 'timestamp="2021-07-14T01:02:34.567Z"' \
--form 'field="test"' \
--form 'data="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<test>TEST<test>"'
- 主要语言
- TypeScript
- 星标
- 1.2k
- 派生
- 245
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Kong/httpsnippet 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 62/100
Kong/httpsnippet#356 ·
-
难度 4/5 3-5 天 新手友好度 35/100
Kong/httpsnippet#397 ·
-
难度 3/5 1-2 天 新手友好度 35/100
Kong/httpsnippet#389 ·
-
难度 5/5 一周以上 新手友好度 25/100
Kong/httpsnippet#383 ·
-
Bug: R Code Generation Does Not Quote Parameters with Special Characters (e.g., `codes[]`)可能已有人在做 @abansal21 于 499 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
Kong/httpsnippet#379 ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
rel: fix
难度 2/5 1-3 小时 新手友好度 68/100
Deltares/fews-web-oc#2400 ·
维护者通常 1 天内回复
-
Command bar: Tab-to-search on claude.ai falls back to Google site: search instead of opening a prompt on Claude可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
ardia-browser/ardia#4426 ·
维护者通常 1 天内回复
-
Bug report: isValidISODateDashOnly accepts text before or after the date-time可能已有人在做 @bardrop 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 88/100
pnp/cli-microsoft365#7713 ·
维护者通常 1 天内回复
-
Diagram: Journey Type: Bug / Error
难度 2/5 1-3 小时 新手友好度 62/100
mermaid-js/mermaid-v13#1293 ·
维护者通常 1 天内回复