web - Receiving and sending cookies with Go client? -
i want go application authenticate website , use received cookie access secure locations. following curl examples illustrates i'm trying do:
authenticate website via x-www-form-urlencoded
, save cookie. data urlencoded automatically:
curl 'https://www.example.com/login' \ --cookie-jar cookies.txt \ --header 'content-type: application/x-www-form-urlencoded' \ --data 'user=user name&pass=pass'
now authentication cookie saved in cookies.txt
, send access page requires login:
curl 'https://www.example.com/profile' \ --cookie cookies.txt
i don't want store cookie on disk in application, in memory can use when required.
does have example of how can achieved in go?
for golang can add cookie request can cookies using this function after making web request.
Comments
Post a Comment