why is the difference between the code generated in postman and by httpsnippet?
- Ngôn ngữ chính
- TypeScript
- Star
- 1.2k
- Fork
- 242
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
I was trying to use httpSnippet to generate client-code in C# and I got
```
var client = new RestClient("https://api.apyhub.com/extract/text/word-file");
var request = new RestRequest(Method.POST);
request.AddHeader("apy-token", "APY0kllzrWDJ1AXxg3cfjxwfAhrXaSuarykmVh2gqleNPi0LujGn4vflrsu1MC58");
request.AddHeader("Content-Type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n@\"test.docx\"\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```
which is differed from I got in postman
```
var options = new RestClientOptions("https://api.apyhub.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/extract/text/word-file", Method.Post);
request.AddHeader("apy-token", "APY0kllzrWDJ1AXxg3cfjxwfAhrXaSuarykmVh2gqleNPi0LujGn4vflrsu1MC58");
request.AlwaysMultipartFormData = true;
request.AddFile("file", "/path/to/file");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
```
are they same ?
why is the differnece ?
Hướng dẫn đóng góp
Hướng nghiên cứu
Start by comparing the C# output from httpsnippet with the C# code generated by Postman for the multipart request shown in the issue. Check whether both snippets send the same file field and request body, then determine whether the discrepancy is an expected library-version difference or a generator bug; done means documenting or correcting the mismatch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp, postman, typescript
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100