Creating a token returns a lowercased Location header, and POST without Content-Type returns 404
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Start with the token Location generation in TokenHandler.cs and the optional-body POST mappings in TokenEndpoints.cs; then read the lowercase URL and fallback routing setup in Program.cs. Add endpoint tests for mixed-case token IDs in the Location header and POST requests without a body or Content-Type. Done means the returned URL preserves the token ID’s case and both optional-body endpoints create tokens successfully.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Two problems with the token create endpoints. The Location header returned after creating a token points to a lowercased token id, so following it returns 404. Separately, POST /api/v2/projects/{projectId}/tokens (and the organization variant) returns 404 instead of creating a token when the request has no body and no Content-Type header, even though the body is documented as optional.
Where
- Location is built with the link generator: TokenHandler.cs#L204-L206
- Routing lowercases all generated URLs, including route values: Program.cs#L166-L168
- Token ids are 40 mixed-case characters: StringExtensions.cs#L76-L81
- Optional-body create endpoints: TokenEndpoints.cs#L111-L116, TokenEndpoints.cs#L136-L141
- SPA fallback that catches the unmatched POST and returns 404: Program.cs#L339, Program.cs#L407-L418
What happens
POST /api/v2/projects/{id}/tokenswithContent-Type: application/jsonreturns201and a header likeLocation: .../api/v2/tokens/abcdefghij....RouteOptions.LowercaseUrls = truelowercases the whole generated path, including theidvalue. Token lookups are case-sensitive, soGETon that URL returns404.curl -X POST -H "Authorization: Bearer <user token>" .../api/v2/projects/{id}/tokens(no body, noContent-Type) returns404. TheAccepts(...)content-type matcher filters out the token endpoint when there is noContent-Type, so the request falls through to the{**slug:nonfile}fallback, which returns404for non-GET requests. WithContent-Type: application/jsonand an empty body, the same request returns201.
I confirmed both behaviors with a minimal ASP.NET Core 10 app that uses the same routing options, endpoint metadata, and fallback route.
Expected
Locationpoints to the created token, preserving its case.- A POST with no body creates a token with default settings, whether or not
Content-Typeis sent, or else the endpoint returns a clear415/400instead of404.
Suggested fix
- Build the token
Locationwithout the lowercasing link generator, for example$"/api/v2/tokens/{model.Id}"or by settingLowercaseUrlsonly for paths. Other entities use lowercase ObjectIds, so they aren't affected. - Drop the
Acceptscontent-type constraint on the two optional-body create endpoints, or treat a missingContent-Typeas acceptable when the body is empty. Add endpoint tests for both cases.
- Ngôn ngữ chính
- C#
- Star
- 2.5k
- Fork
- 508
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 40
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- 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 exceptionless/Exceptionless
-
bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
exceptionless/Exceptionless#2707 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
exceptionless/Exceptionless#2706 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
exceptionless/Exceptionless#2705 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
exceptionless/Exceptionless#2704 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
exceptionless/Exceptionless#2703 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của exceptionless/Exceptionless
Issue tương tự
-
Add dependency list in documentsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Add 'upm' tag on githubĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug mac アプリ: コード アプリ: チャット 優先: 中 要トリアージ
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
yksr-melt/Meltype#1346 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Collect corrected translations in the app, with no GitHub account and the least possible frictionĐang mởlocalization medium ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
hexide-io/HexIDE#2819 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày