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
- 分支
- 241
- 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 ·
-
難度 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[]`)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
Kong/httpsnippet#379 ·
-
難度 3/5 1-2 天 新手友好度 48/100
Kong/httpsnippet#370 ·
相似的 Issue
-
enhancement good first issue priority: low size: XS
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 88/100
-
難度 1/5 1 小時以內 新手友好度 90/100
streamplace/streamplace#1351 ·
維護者通常 2 天內回覆
-
automated issue report
難度 2/5 1-3 小時 新手友好度 66/100
databendlabs/databend-docs#3511 ·
-
automated issue report
難度 2/5 1-3 小時 新手友好度 65/100