Kong / Kong/httpsnippet

why is the difference between the code generated in postman and by httpsnippet?

未關閉
#315 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
1.2k
分支
242
PR 合併指標
30 天內沒有已合併 PR

描述

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 ?

貢獻指南

開啟貢獻指南

研究方向

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.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, postman, typescript
領域
developer-experience, tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。