![](/img/trans.png)
[英]In .NET Core 3.1, the RequestCookieCollection can no longer be used to create cookies in unit tests
[英]what's the alternative of RequestCookieCollection and ResponseCookies in .net core 3.1?
根據這個 github 帖子https://github.com/dotnet/aspnetcore/issues/18193 ,RequestCookieCollection() 是故意在內部進行的,因此您必須使用接口 IRequestCookieCollection。
如果您注意到,Visual Studio auto 建議在兩種情況下都使用該界面。
您可以使用接口或復制實現代碼並直接使用它,但這可能會引入更改,從而使復制的代碼過時。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.