Implement your own cookie jar, See also: https://github.com/golang/go/issues/19291#issuecomment-282576908
- sean On Wed, Jun 29, 2022 at 11:31 PM Amit Saha <amitsaha...@gmail.com> wrote: > Hi all, > > Currently the Cookies() method as explained at > https://pkg.go.dev/net/http/cookiejar#Jar.Cookies only adds the Name and > Value of the cookies and strips out the MaxAge and Expires field (and all > other fields). Presumably, as I can see in the code, the logic is if a > cookie is returned as a return value from this method, that means, the > cookie is valid - expiry date is in the future, for example. > > In the context of testing my HTTP handler, I wanted to make sure that the > expiry of a certain cookie is set to a specific time in the future. > > However, the above implementation doesn't make it possible. Is that a fair > expectation to have that the cookiejar's Cookies() method will preserve the > Expires/MaxAge field of the cookie so that I can verify my HTTP handler > function logic? Or is there another alternative suggestion? > > Thanks, > Amit. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CANODV3%3D6jUAAsKSkJ3iz5t3U6NH2EDSq0jRG02gmPBYd46Afew%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CANODV3%3D6jUAAsKSkJ3iz5t3U6NH2EDSq0jRG02gmPBYd46Afew%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAGabyPrVu4%3DC_KLvC_DkQpuw4KSkSSryUagdD1jZ05Ufa8WRoQ%40mail.gmail.com.