Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Api 邮递员,更改cookie值_Api_Cookies_Postman - Fatal编程技术网

Api 邮递员,更改cookie值

Api 邮递员,更改cookie值,api,cookies,postman,Api,Cookies,Postman,我在更改postman中的返回身份验证cookie值时遇到问题。我有一个名为token的环境变量,我的初始登录POST请求包含以下测试: if (postman.getResponseCookie("ccsrftoken")) { tests["Login successfull"] = responseCode.code === 200; var token = postman.getResponseCookie("ccsrftoken").value; var clean_token = t

我在更改postman中的返回身份验证cookie值时遇到问题。我有一个名为token的环境变量,我的初始登录POST请求包含以下测试:

if (postman.getResponseCookie("ccsrftoken")) {
tests["Login successfull"] = responseCode.code === 200;
var token = postman.getResponseCookie("ccsrftoken").value;
var clean_token = token.replace('"','').replace('"','');
postman.setEnvironmentVariable("token", clean_token);
请求后,我可以看到有一个cookieccsrftoken可用,其值如下:

ccsrftoken="34FDB4830CE5C33A54566B9BEDEE3B2"; path=/; domain=29.203.248.13; Expires=Tue Jan 19 2038 02:14:07 GMT-0600 (Central Standard Time);
但是环境变量设置为

%2234FDB4830CE5C33A54566B9BEDEE3B2%22

似乎我的替换代码没有按预期工作,字符串中仍然存在“替换”。我还尝试了替换(“\”,”)变量,得到了相同的结果

我认为你实际上不需要做任何更换。
我一直以这种方式拉JSESSIONID,当您使用.value时,它已经只拉“34FDB4830CE5C33A54566B9BEDEE3B2”并跳过其余部分。

嗨,Klubi,最后我稍微更改了替换函数,而不是替换“字符”,我将其更改为%22,现在它按预期工作。