Kong / Kong/httpsnippet

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

Aberta
#315 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
1.2k
Forks
242
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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 ?

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
csharp, postman, typescript
Domínio
developer-experience, tooling
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.