GET 要求の応答に Cache-Control ヘッダーを設定しようとしています。
これは OPTIONS リクエストで動作します:
PreRequestFilters.Add((httpRequest, httpResponse) =>
{
if (httpRequest.HttpMethod == "OPTIONS")
{
httpResponse.AddHeader("Cache-Control", "no-cache");
httpResponse.EndServiceStackRequest();
}
});
これは、GET リクエストでは機能しません。
ResponseFilters.Add((httpRequest, httpResponse, dto) =>
{
httpResponse.AddHeader("Cache-Control", "no-cache");
});
フィルターは機能しています...また、上記の方法を使用して、応答に独自のヘッダーを追加することもできます。
私は3.9.58を使用しています。
これは (ServiceStack または私のコードの) バグですか、それとも REST および GET 要求の性質による設計によるものですか?