-
Notifications
You must be signed in to change notification settings - Fork 285
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
Create functional option for ctx.SetCookie #208
Create functional option for ctx.SetCookie #208
Conversation
Signed-off-by: Andrew Thornton <art27@cantab.net>
…the cookie Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
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.
Thanks for the PR!
Can we also have some tests to cover uses of these helpers?
Likely will be added to here:
Lines 206 to 212 in d229aed
Convey("Set and get cookie", func() { | |
m.Get("/set", func(ctx *Context) { | |
t, err := time.Parse(time.RFC1123, "Sun, 13 Mar 2016 01:29:26 UTC") | |
So(err, ShouldBeNil) | |
ctx.SetCookie("user", "Unknwon", 1, "/", "localhost", true, true, t) | |
ctx.SetCookie("user", "Unknwon", int32(1), "/", "localhost", 1) | |
ctx.SetCookie("user", "Unknwon", int64(1)) |
Co-authored-by: ᴜɴᴋɴᴡᴏɴ <u@gogs.io>
…macaron into upstream-functional-set-cookie
Co-authored-by: 6543 <6543@obermui.de>
@unknwon It's ready again :) |
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.
Thanks for the follow up!
https://github.com/go-macaron/macaron/releases/tag/v1.4.0 has been published for this merge. |
Allowing
func(*http.Cookie)
to be passed into the SetCookie call will allow us to extend SetCookie to set the SameSite attribute easily.(This PR also does some slight cleanup to context.go fixing minor lint issues.)