acacode / acacode/swagger-typescript-api

Throws on formatter JSON when 204 No Content

Aperta
#270 0 commenti 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
4.1k
Fork
436
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.