Creating a token returns a lowercased Location header, and POST without Content-Type returns 404
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C#
- スター
- 2.5k
- フォーク
- 508
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 40
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
exceptionless/Exceptionless のほかの issue
-
bug documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
exceptionless/Exceptionless#2707 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
exceptionless/Exceptionless#2706 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
exceptionless/Exceptionless#2705 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
exceptionless/Exceptionless#2704 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
exceptionless/Exceptionless#2703 ·
メンテナーはふだん 1 日以内に返信
exceptionless/Exceptionless の issue をすべて見る
似ている issue
-
bug effort:S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
nightscout/nocturne#3093 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100