Decide how invalid options are handled in the next major
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 28/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- express, javascript, node.js
- Lĩnh vực
- backend
Hướng nghiên cứu
Start by reading normalizeOptions and the json(), urlencoded(), and text() parser entry points to compare how each option is validated. Review the reported defaultCharset cases and the related change in #764. Done means a policy for invalid options has been selected, consistently implemented across parsers, and covered by tests, including case-insensitive charset handling.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
@Phillip9587 suggested an issue for this in #764. Measured on master (02101da) with Node 26; the Express results use Express 5.3.0.
normalizeOptions, one option at a time:
| option | 42 |
false |
0 |
'' |
{} |
|---|---|---|---|---|---|
inflate |
true |
false |
true |
true |
true |
limit |
42 |
throws | 0 |
throws | throws |
verify |
throws | false |
false |
false |
throws |
defaultCharset |
42 |
'utf-8' |
'utf-8' |
'utf-8' |
{} |
type: 42 is accepted, and shouldParse() then returns false for an application/json request, so the parser quietly skips it.
defaultCharset across the parsers, for a request without a charset:
'UTF-8' |
42 or {} |
|
|---|---|---|
json() |
415 unsupported charset "UTF-8" |
each request throws TypeError: charset.slice is not a function (500 in Express) |
urlencoded() |
throws at construction | throws at construction |
text() |
200 | throws TypeError: encoding.toUpperCase is not a function inside the raw-body callback; Express cannot catch it and the process exits |
All three treat 0, false and '' as 'utf-8'.
So one option gets three policies: checked at construction in urlencoded(), per request in json(), and not at all in text(), where a non-string value ends the process on the first request.
The question for the next major is which policy all options follow: check types at construction and throw, as limit and verify partly do, or coerce. Either way, defaultCharset needs lower-casing before the utf-8/iso-8859-1 checks, which is what #764 does.
- Ngôn ngữ chính
- JavaScript
- Star
- 5.5k
- Fork
- 802
- Merge trung bình
- 7 giờ 54 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay 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 expressjs/body-parser
-
discuss ideas semver-major
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
expressjs/body-parser#780 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update to raw-body v4.0.0Đang mởdeps semver-major
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
expressjs/body-parser#758 · 12 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Almost all non-utf8 encodings are incorrectCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
expressjs/body-parser#680 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
expressjs/body-parser#658 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
question
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
expressjs/body-parser#633 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của expressjs/body-parser
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
anothaDev/luci-theme-vantage#143 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
kingcharleslzy-ai/dsh-purge#282 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
a-corriger bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
christian-raj/S-Aloha#340 ·
-
area:image documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày