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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -