xxxxxxxxxx
setcookie($cookie_name,$cookie_value,time() + (86400 * 30), "/");
xxxxxxxxxx
function display() {
var now = new Date();
var time = now.getTime();
var expireTime = time + 1000*36000;
now.setTime(expireTime);
document.cookie = 'cookie=ok;expires='+now.toUTCString()+';path=/';
//console.log(document.cookie); // 'Wed, 31 Oct 2012 08:50:17 UTC'
}
xxxxxxxxxx
HTTP/1.1 307 Temporary Redirect
Location: /
Set-Cookie: myappcookie=encryptedvalue==; Path=/; Expires=Fri, 13 Sep 2013 21:12:12 UTC; Max-Age=900; HttpOnly; Secure
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Date: Fri, 13 Sep 2013 20:57:12 GMT
xxxxxxxxxx
To handle cookie in postman there is a button
called cookie to give us a way to add cookie
to certain domain by providing key+value pair
Once added any request sent to the same domain,
can access that cookie. We can also access to
the cookie in test tab.
pm.test('the "abc" cookie has correct value', function () {
pm.expect(pm.cookies.toObject()).to.have.property('abc', 'AWESOME');
});
pm.test('the "Motto" cookie has correct value', function () {
pm.expect(pm.cookies.toObject()).to.have.property('Motto', 'Hold your horse');