Answer 413 instead of cutting the connection when a request body is too large
Maintainer thường phản hồi trong vòng 1 ngày
@PrathamAsrani đang làm issue này rồi.
Từ ngày 25/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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, functionreadBody(around line 297)tests/api.test.mjs, testimport: 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
413response with{"error": "Payload too large"} - The test asserts exactly
413(drop theconnection closedalternative) - The server keeps working for the next request
-
npm testpasses
Mentor
@0b3l1X-SolidGeeks
- Ngôn ngữ chính
- JavaScript
- Star
- 0
- Fork
- 1
- Merge trung bình
- 14 phút
- Pull request đã merge (30 ngày)
- 31
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SolidGeeks/strata
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
SolidGeeks/strata#21 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 22/100
SolidGeeks/strata#22 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SolidGeeks/strata#20 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SolidGeeks/strata
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apex-dev-tools/apex-log-parser#199 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
ReadBufferStream.addBuffer adds the full ArrayBuffer of a typed array view, and ignores its byteOffsetCó thể đã có người làm @wayfarer3130 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Expo 57 example: pnpm install fails with ERR_PNPM_TRUST_DOWNGRADECó thể đã có người làm @github-actions đã nhận hôm nay. Đang mởbug react-native team/client-libraries
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
PostHog/posthog-js#5442 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày