Generate Robust C# Code
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- csharp, typescript
調査の方向性
C# のスニペット生成のエントリーポイントから始め、現在の form-urlencoded 出力を issue の 2 つの例と比較し、パラメーター名と値がどのように表現されているかに注目します。生成された C# が、エンコード済みのリクエストボディ文字列を 1 つ埋め込むのではなく、実行時に安全な URL エンコードを用いたリクエストパラメーターを使用すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Improvement Suggestion:
I would have liked the following autogenerated C# for a HTTP POST request with the single parameter err of value + & serialized as x-www-form-urlencoded in the body.
var client = new RestClient("https://localhost");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "da4d0044-61a9-3943-40db-9e753aca6020");
request.AddHeader("cache-control", "no-cache");
Action<string,string> parameter = (name, value) => request.AddParameter(name, value);
parameter("err", "+ &");
IRestResponse response = client.Execute(request);
but what Postman did produce for me was the following C# code:
var client = new RestClient("https://localhost");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "da4d0044-61a9-3943-40db-9e753aca6020");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "err=%2B%20%26", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Rationale
parameter("err", "+ &");is more readable than "[..]err=%2B%20%26[..]". The value,+ &, is more recognizable.- The code is more maintanable. At work, I tried the following development workflow:
(a) Type a minimal working example request into to Postman.
(b) Generate C# code.
(c) Copy generated code to Visual Studio.
(d) Replace example values by C# method parameters.
This workflow failed, because the method parameters were not x-www-form-urlencoded at runtime. Generating UrlEncode() calls would make writing a consumer of a HTTP POST x-www-form-urlencoded API effortless. - This usage of
IRestRequest.AddParameteris encouraged, whereas the currently generated code depends on an internal hack not meant for 3rd party usage.
/// - RequestBody: Used by AddBody() (not recommended to use directly)
App Details:
Postman for Windows
Version 5.3.2
win32 6.1.7601 / x64
Continuation of: https://github.com/postmanlabs/postman-app-support/issues/3870
- 主要言語
- TypeScript
- スター
- 1.2k
- フォーク
- 245
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 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 ·
Kong/httpsnippet の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
rel: fix
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Deltares/fews-web-oc#2400 ·
メンテナーはふだん 1 日以内に返信
-
難易度 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 日以内に返信