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

Answer 413 instead of cutting the connection when a request body is too large

クローズ
#3 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

2026年10月25日 から。

評価

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

説明

good first issue help wanted
The task

When a request body is larger than its limit (for example an import bigger than MAX_IMPORT_MB), the server should answer 413 Payload too large with its usual JSON error. Today it cuts the connection instead: curl fails with error 56, and the app can only show a generic network error, so the user never learns that the file was simply too big.

The cause is in readBody: after rejecting with a 413, it calls req.destroy(), which closes the socket before the error response can be sent. Stop buffering the body instead, let the 413 response go out, and close the connection only after it (for example with a Connection: close header).

Where to look
  • server/server.js, function readBody (around line 297)
  • tests/api.test.mjs, test import: replaces the map, validates ids, and enforces MAX_IMPORT_MB: it currently accepts either a 413 or a closed connection, which hides the bug

Reproduce: start the server with MAX_IMPORT_MB=1 and post a 1.3 MB JSON body to /api/import.

Done when
  • An oversized body gets a 413 response with {"error": "Payload too large"}
  • The test asserts exactly 413 (drop the connection closed alternative)
  • The server keeps working for the next request
  • npm test passes
Mentor

@0b3l1X-SolidGeeks

主要言語
JavaScript
スター
0
フォーク
1
平均マージ
14分
マージ済み PR(30日)
31

環境構築

はじめの一歩

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

SolidGeeks/strata のほかの issue

SolidGeeks/strata の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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