acacode / acacode/swagger-typescript-api

Throws on formatter JSON when 204 No Content

Aberta
#270 0 comentários 3 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
4.1k
Forks
436
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

In general it makes sense to always set your formatter to JSON as most of the methods are JSON responses.

The only exception that would make sense to generally skip the formating step would be if the http response is a 204 NO CONTENT. This makes sense basically in all `DELETE` HTTP calls and in some other scenarios.

This would also comply with the case that a HttpResponse type could be void, which in general in our swagger scenario is the case for DELETE. I am not 100% sure how the standard is, but I think in general if the swagger definition can define the Response Type as void and it still tries to format to JSON, it is clear that it will not work out.

https://github.com/acacode/swagger-typescript-api/blob/37efbb9e5deb5f60b680994ad908332033f03fa8/templates/base/http-clients/fetch-http-client.eta#L194

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

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