SetContentType middleware breaks Content-Type detection for requests

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go
領域
api

調査の方向性

まず SetContentType、GetRequestContentType、DefaultDecoder の場所を特定し、共有コンテキストキーが request の Content-Type 検出のためにどのように読み取られているかを追跡します。既存の middleware と decoder の動作を確認し、焦点を絞った回帰テストの場所を特定して、issue で提案されているコンテキスト状態の分離を検討します。response の処理が request の検出に干渉しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

The documentation for SetContentType only mentions responses and says nothing of requests:

SetContentType is a middleware that forces response Content-Type.

However, this breaks Content-Type detection for requests in the DefaultDecoder because SetContentType and GetRequestContentType share the same context key.

It's not obvious to me why GetRequestContentType even looks at the context, as that seems to betray the function name. But if that behavior is going to stay, I suggest using a separate context key so that SetContentType does not interfere.

主要言語
Go
スター
340
フォーク
69
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

go-chi/render のほかの issue

go-chi/render の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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