-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASP.NET Response Cookie Layout Renderer #789
ASP.NET Response Cookie Layout Renderer #789
Conversation
Codecov Report
@@ Coverage Diff @@
## master #789 +/- ##
======================================
+ Coverage 63% 68% +5%
======================================
Files 48 59 +11
Lines 790 1010 +220
Branches 196 251 +55
======================================
+ Hits 498 684 +186
- Misses 223 225 +2
- Partials 69 101 +32
Continue to review full report at Codecov.
|
src/Shared/LayoutRenderers/AspNetResponseCookieLayoutRenderer.cs
Outdated
Show resolved
Hide resolved
The 3 code smell come from the code I copy from RequestCookieLayoutRenderer. |
Will this not work for ASP_NET_CORE (net5 + netcoreapp3 + netstandard2), and will be faster than protected IList<SetCookieHeaderValue> GetCookies(HttpResponse response)
{
var queryResults = response.Headers[HeaderNames.SetCookie];
if (queryResults.Count > 0 && SetCookieHeaderValue.TryParseList(queryResults, out var result))
return result;
else
return Array.Empty<SetCookieHeaderValue>();
} |
…case, otherwise we cannot finish this layout renderer
Added back Microsoft.AspNetCore.http.Extensions NuGet Package, but ONLY for ASP_NET_CORE2 case. |
oh sorry I did not see, i will try that. Did not realize there is parselist method. I was just doing parse where I split the string by comma, but that is brittle. |
src/Shared/LayoutRenderers/AspNetResponseCookieLayoutRenderer.cs
Outdated
Show resolved
Hide resolved
src/Shared/LayoutRenderers/AspNetResponseCookieLayoutRenderer.cs
Outdated
Show resolved
Hide resolved
src/Shared/LayoutRenderers/AspNetResponseCookieLayoutRenderer.cs
Outdated
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
Thanks again for completing all my comments. And great work with the test-coverage. |
Add Response Cookie Layout Render based on request Cookie layout render.
But, this has important difference for ASP.NET Core version.
We need to install Microsoft.AspNetCore.Http.Extensions NuGet package version 2.1.x other wise the cookie for response can only be Append() or Delete().
So, when we install this NuGet, it installs extension methods for Session named GetString() and GetInt32().
So these 2 method need to be delete from HttpContextExtensions.cs otherwise compiler gives 2 ambiguous call errors.
After these are deleted, re-executing all the unit test still give successful results.