Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Cerrado
#3 2 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@PrathamAsrani ya está trabajando en esto.

Desde el 25/10/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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

Lenguaje dominante
JavaScript
Estrellas
0
Forks
1
Merge medio
14 min
PR fusionados (30 d)
31

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de SolidGeeks/strata

Todos los issues de SolidGeeks/strata

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.