5

I have to send request using curl, in that request i needs to set the cookie from the below response. So can some one help me how to pass all the cookies in the curl request

HTTP/1.1 200 OK  
X-Powered-By: Express  
Access-Control-Allow-Origin:undefined  
Access-Control-Allow-Credentials: true 
Access-Control-Allow-Methods: GET,POST,OPTIONS 
Access-Control-Allow-Headers: Content-Type  
set-cookie: SESSIONID=agpuB2CqPDhkupxfbrZXCR; Path=/ABC  
set-cookie: bac_cookie=7959aacd5cc48;Domain=abc.com;Expires=Mon, 05-Dec-2016 18:47:42 GMT; Path=/
set-cookie: beID=0023T21; Domain=abc.com; Expires=Mon,05-Dec-2016 18:47:42 GMT; Path=/  
set-cookie:USER_JSESSIONID=agpuB2CqPDhkupxfbrJlbXF3;Domain=abc.com;Expires=Mon, 05-Dec-2016 18:47:42 GMT; Path=/ 
set-cookie:bac_user_info="UserName|UserLName|UserMailId"; Version=1;Domain=abc.com; Max-Age=3600; Path=/  
set-cookie: beID=0023T21; Domain=abc.com; Expires=Mon, 05-Dec-2016 18:47:42 GMT; Path=/ 
set-cookie:NSC_WB2-CF-8080=ffffffff09ae530a45525d5f4f58455e445a4a4229a0;path=/;httponly
Content-Type: application/json; charset=utf-8  
Content-Length: 131 
ETag: W/"83-+Jfk31hxbwmLWd1hTlIO1Q"  
Date: Mon, 05 Dec 2016 17:47:42 GMT  
Connection: abc
Madrini
  • 51
  • 1
  • 1
  • 5
  • 1
    Possible duplicate of [curl: how to send cookies via command line?](http://stackoverflow.com/questions/15995919/curl-how-to-send-cookies-via-command-line) – peteb Dec 05 '16 at 18:38
  • I have to send multiple cookies in the curl – Madrini Dec 05 '16 at 18:49

1 Answers1

13

If you want to send multiple cookies, then just separate them by the ; delimiter.

curl -v --cookie "TOKEN1=Yes;TOKEN2=no" "http://127.0.0.1:5000"
OTP User
  • 3
  • 2
Rayee Roded
  • 2,440
  • 1
  • 20
  • 21