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

Commit 88b47e1

Browse files
committed
Adds samesite
1 parent 91d0abf commit 88b47e1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Microsoft.AspNetCore.Http/Internal/ResponseCookies.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ public void Delete(string key, CookieOptions options)
130130
Domain = options.Domain,
131131
Expires = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc),
132132
Secure = options.Secure,
133-
HttpOnly = options.HttpOnly
133+
HttpOnly = options.HttpOnly,
134+
SameSite = options.SameSite
134135
});
135136
}
136137
}

test/Microsoft.AspNetCore.Http.Tests/ResponseCookiesTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public void DeleteCookieWithCookieOptionsShouldKeepPropertiesOfCookieOptions()
4141
HttpOnly = true,
4242
Path = "/",
4343
Expires = time,
44-
Domain = "example.com"
44+
Domain = "example.com",
45+
SameSite = SameSiteMode.Lax
4546
};
4647

4748
cookies.Delete(testcookie, options);
@@ -53,6 +54,7 @@ public void DeleteCookieWithCookieOptionsShouldKeepPropertiesOfCookieOptions()
5354
Assert.Contains("expires=Thu, 01 Jan 1970 00:00:00 GMT", cookieHeaderValues[0]);
5455
Assert.Contains("secure", cookieHeaderValues[0]);
5556
Assert.Contains("httponly", cookieHeaderValues[0]);
57+
Assert.Contains("samesite", cookieHeaderValues[0]);
5658
}
5759

5860
[Fact]

0 commit comments

Comments
 (0)