八、postman的cookie支持

postman中可以直接添加cookie,查看响应中的cookie

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'));
}

 

posted @ 2019-07-28 15:27  李清欣  阅读(340)  评论(0编辑  收藏  举报