-
Notifications
You must be signed in to change notification settings - Fork 66
Add CookieBuilder property to SessionOptions and obsolete duplicated properties #173
Conversation
public override string Name | ||
{ | ||
get => base.Name; | ||
set => base.Name = !string.IsNullOrEmpty(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider moving this check to the base class, there's no reason for the cookie name to ever be null/empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -105,8 +105,11 @@ public class SessionTests | |||
{ | |||
app.UseSession(new SessionOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR, but this is pretty gross, given that Session is using IOptions<SessionOptions>
we should really kill this pattern.
If we want to avoid making them go Configure<SessionOptions>(o => )
, we can change UseSession(o => o.Cookie.Name = "TestCookie")
, this new SessionOptions/Wrapper pattern stuff needs to burn....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tratcher @davidfowl @ajcvickers @divega thoughts? Can we get rid of all instances where we UseXyz(new XyzOptions())
and consistently always use UseXyz(o => )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming UseXyz is using IOptions...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth considering, but not as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just meant a cleanup pass for all middleware doing this, not something for this PR, I'll file an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
public override TimeSpan? Expiration | ||
{ | ||
get => default(TimeSpan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return null.
931aee7
to
dece939
Compare
Addresses aspnet/HttpAbstractions#853.
Uses the new CookieBuilder API added here: aspnet/HttpAbstractions#882.
cc @HaoK @blowdart