Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Creating a token returns a lowercased Location header, and POST without Content-Type returns 404

オープン
#2,699 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp
領域
api, backend

調査の方向性

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 の本文から書いたものです。

説明

bug

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

What happens

  1. POST /api/v2/projects/{id}/tokens with Content-Type: application/json returns 201 and a header like Location: .../api/v2/tokens/abcdefghij.... RouteOptions.LowercaseUrls = true lowercases the whole generated path, including the id value. Token lookups are case-sensitive, so GET on that URL returns 404.
  2. curl -X POST -H "Authorization: Bearer <user token>" .../api/v2/projects/{id}/tokens (no body, no Content-Type) returns 404. The Accepts(...) content-type matcher filters out the token endpoint when there is no Content-Type, so the request falls through to the {**slug:nonfile} fallback, which returns 404 for non-GET requests. With Content-Type: application/json and an empty body, the same request returns 201.

I confirmed both behaviors with a minimal ASP.NET Core 10 app that uses the same routing options, endpoint metadata, and fallback route.

Expected

  • Location points to the created token, preserving its case.
  • A POST with no body creates a token with default settings, whether or not Content-Type is sent, or else the endpoint returns a clear 415/400 instead of 404.

Suggested fix

  • Build the token Location without the lowercasing link generator, for example $"/api/v2/tokens/{model.Id}" or by setting LowercaseUrls only for paths. Other entities use lowercase ObjectIds, so they aren't affected.
  • Drop the Accepts content-type constraint on the two optional-body create endpoints, or treat a missing Content-Type as acceptable when the body is empty. Add endpoint tests for both cases.
主要言語
C#
スター
2.5k
フォーク
508
平均マージ
2日 17時間
マージ済み PR(30日)
40

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

exceptionless/Exceptionless のほかの issue

exceptionless/Exceptionless の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。