![](/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.