在国旗上测试cookie



我正在尝试在Postman App(Chrome Ext。)中编写一些测试。我有一个简单的http请求:

GET /BusinessBanking/ HTTP/1.1
Host: www.mojebanka.cz

返回了两个不同的cookie,带有不同的http和安全标志。

cookie标志

现在我运行了这些测试,所有测试都通过:

tests ["cookie1 HTTP"] = postman.getResponseCookie("JSESSIONID").http = true;
tests ["cookie1 secure"] = postman.getResponseCookie("JSESSIONID").secure = true;
tests ["cookie2 HTTP"] = postman.getResponseCookie("language").http = true;
tests ["cookie2 secure"] = postman.getResponseCookie("language").secure = true;

所以我的问题是,如何在HTTP和安全标志上测试这些cookie?

我想出了,如何在httponly and Secure标志上执行测试:

tests ["cookie1 HTTP"] = postman.getResponseCookie("JSESSIONID").httpOnly === true;
tests ["cookie1 secure"] = postman.getResponseCookie("JSESSIONID").secure === true;
tests ["cookie2 HTTP"] = postman.getResponseCookie("language").httpOnly === false;
tests ["cookie2 secure"] = postman.getResponseCookie("language").secure === false; 

因此,甚至可以以这种方式测试cookie(或httponly)。

最新更新