如何在curl请求中传递cookie

时间:2016-12-05 18:37:36

标签: node.js http

我必须使用curl发送请求,在该请求中我需要从下面的响应中设置cookie。 那么有人可以帮助我如何传递卷曲请求中的所有cookie

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

1 个答案:

答案 0 :(得分:0)

如果您想发送多个Cookie,只需通过 //Form validation setup $form.formValidation({ framework: 'bootstrap', // Feedback icons icon: { valid: 'fa fa-check', invalid: 'fa fa-remove', validating: 'fa fa-refresh' }, fields: { ctl00$kcMasterPagePlaceHolder$TextBoxCaseNumber: { trigger: 'blur', validators: { notEmpty: { message: 'Case Number is Required' }, remote:{ message: 'Case Number does not exist. Please contact XXXXX', url: function(validator, $field, value) { return './handlers/ServiceInterface.ashx?apistring=api/case/1234'; }, cache: false, data: function(validator, $field, value) { return { valid: true }; } }, // end remote my_remote:{ alias: "remote", message: 'Warning: There is already an event for this case on this calendar!', url: function(validator, $field, value) { var strArguments = "1234"; return './handlers/ServiceInterface.ashx?apistring=api/event?casenumber=' + strArguments ; }, cache: false, data: function(validator, $field, value) { return { valid: true }; } } // end remote } }

进行补充即可
;