Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Adds MaxAge Property to CookieOptions and CookieBuilder #904

Merged
merged 1 commit into from
Aug 22, 2017

Conversation

jkotalik
Copy link
Contributor

#688
@Tratcher Not sure if there is more to do here than this.

@Tratcher
Copy link
Member

And

using Microsoft.AspNetCore.Http.Internal;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Net.Http.Headers;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No updated ResponseCookies test?

@jkotalik
Copy link
Contributor Author

jkotalik commented Jul 27, 2017

@Tratcher Should Max-Age be a header name in HeaderNames.cs?

@Tratcher
Copy link
Member

No, it's not a header name, it's a header property name.

@jkotalik
Copy link
Contributor Author

@Tratcher Do you recommend doing a full E2E to verify max-age shows up on requests?

@Tratcher
Copy link
Member

Tratcher commented Aug 2, 2017

on requests? None of the cookie settings are echoed on the request, on the the name and value. It's worth doing some manual testing though to make sure major browsers and HttpClient honor this setting.

@muratg
Copy link

muratg commented Aug 8, 2017

ping

@jkotalik jkotalik changed the title [WIP] Adds MaxAge Property to CookieOptions and CookieBuilder Adds MaxAge Property to CookieOptions and CookieBuilder Aug 9, 2017
@jkotalik
Copy link
Contributor Author

jkotalik commented Aug 9, 2017

@Tratcher I verified locally and the max-age header is sent in the response. :shipit: ?

@Tratcher
Copy link
Member

Tratcher commented Aug 9, 2017

Did you verify that various browsers and clients honor it? Or at least don't choke on it? HttpClient, IE, Chrome, Firefox... I just want to make sure this new property is useful to somebody.

@@ -39,6 +39,16 @@ public void ComputesExpiration()
}

[Fact]
public void ComputesMaxAge()
{
Assert.Null(new CookieBuilder().Build(new DefaultHttpContext()).Expires);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why check Expires in a MaxAge test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops.

@jkotalik jkotalik force-pushed the jkotalik/MaxAge branch 2 times, most recently from bdc5c56 to 1521ee0 Compare August 14, 2017 16:18
@muratg
Copy link

muratg commented Aug 15, 2017

ping :)


var cookieHeaderValues = headers[HeaderNames.SetCookie];
Assert.Equal(1, cookieHeaderValues.Count);
Assert.Contains("max-age=", cookieHeaderValues[0]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're setting one hour, you should be able to check that value here.

@jkotalik jkotalik merged commit 6657f4c into dev Aug 22, 2017
@jkotalik jkotalik deleted the jkotalik/MaxAge branch August 23, 2017 00:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants