Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Autogenerated Fetcher Throws Error on 204 No Content

オープン
#257 コメント 0 件 リアクション 2 件 担当者 1 名 GitHub で見る

@fabien0102 がすでに取り組んでいます。

2025年2月4日 から。

評価

この issue はまだ評価されていません。

説明

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.

主要言語
TypeScript
スター
634
フォーク
83
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fabien0102/openapi-codegen のほかの issue

fabien0102/openapi-codegen の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。