Eight, postman's cookie support

postman can be added directly cookie, view the cookie in the response

https://postman-echo.com/cookies/set?foo1=bar1&foo2=bar2

var respnseJSON;
try{
    tests["Body contains cookies"] = responseBody.has("cookies");
    responseJSON = JSON.parse(responseBody);
    tests["Cookies object is empty"] = (Object.keys(responseJSON.cookies).length > 0)
}
catch (e){
    tests["Status code is 200"] = responseCode.code === 200;
    console.log(pm.cookies.get('foo1'));
}

 

Guess you like

Origin www.cnblogs.com/xinxin1994/p/11259149.html