Hello, when I create cookie with Name, Value and Expires filled in (via http.SetCookie) and then use func (*Request) Cookie, I’ll get just the Name and the Value of the cookie. How can I get Expiration date and time of that cookie? My browser show me the expiration date, but when I suck the cookie via func (*Request) Cookie to variable and then SetCookie again, it will set the cookie just for the session. Thanks.more info to the cookie? Thank you very much.
Regrettably the cookie specification does not make that information available, so the net/http package cannot provide it.
But when I set the cookie and with Expires field filled in I look to cookie in dev. tools in the browser, it shows me the expiration date. Where is this date stored then? I am really confused. Sorry for my little knowledge.
All that data is maintained on the client and not transmitted to the server.
Let’s turn the question around. If you could retrieve the expiration date from a cookie, what would you do with that information? Maybe there is some way to solve that problem instead.
yep, a very good question. maybe @benesva4 will explain what he want to do with that information.
Hi again. Sorry for not responding. There was not any reason for me or any problem I was trying to solve. I was simply playing with the cookies. I tried to make a cookie with fixed date of expiration and then update the Value of the cookie later without changing anything else.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.