Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Autogenerated Fetcher Throws Error on 204 No Content

Aperta
#257 0 commenti 2 reazioni 1 assegnatario Vedi su GitHub

@fabien0102 ci sta già lavorando.

Dal 4/2/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Problem

Was running into an issue when our backend openapi spec'd response for an endpoint was a 204 No Content success status. The client side code was throwing an error so we couldn't trigger the onSuccess function through the react query component. The error was the following thrown in the autogenerated fetcher script:

message: "Network error (Unexpected end of JSON input)"name: "unknown"stack: SyntaxError: Unexpected end of JSON input
Workaround

Check the response status in the fetcher AFTER the fetch, e.g.

if (response.status === 204) {
    return {} as TData;
}

Could also return null or something else you want.

Lingua principale
TypeScript
Stelle
634
Fork
83
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fabien0102/openapi-codegen

Tutte le issue di fabien0102/openapi-codegen

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.