Generate Robust C# Code
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp, typescript
Hướng nghiên cứu
Bắt đầu từ entry point tạo snippet C# và so sánh đầu ra form-urlencoded hiện tại với hai ví dụ trong issue, tập trung vào cách tên và giá trị tham số được biểu diễn. Được xem là hoàn tất khi C# được tạo sử dụng các tham số request với mã hóa URL an toàn tại runtime thay vì nhúng một chuỗi body của request đã được mã hóa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 1.2k
- Fork
- 245
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Kong/httpsnippet
-
BUG: Http default clientId errorĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
Kong/httpsnippet#356 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Kong/httpsnippet#397 ·
-
v3.0.9 Bug: Can't resolve 'fs'Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Kong/httpsnippet#389 ·
-
Support for Oracle APEXĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Kong/httpsnippet#383 ·
-
Bug: R Code Generation Does Not Quote Parameters with Special Characters (e.g., `codes[]`)Có thể đã có người làm @abansal21 đã nhận 499 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Kong/httpsnippet#379 ·
Tất cả issue của Kong/httpsnippet
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
rel: fix
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Deltares/fews-web-oc#2400 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
ardia-browser/ardia#4426 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug report: isValidISODateDashOnly accepts text before or after the date-timeCó thể đã có người làm @bardrop đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
pnp/cli-microsoft365#7713 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Diagram: Journey Type: Bug / Error
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
mermaid-js/mermaid-v13#1293 ·
Maintainer thường phản hồi trong vòng 1 ngày