[removed] = '__Secure-COOKIENAME=cookie-value' + '; Path=/' + '; expires=Fri, 12 Aug 2016 23:05:17 GMT' + '; Secure' + '; Domain=example.org'; // now we could assume the write succeeded, but since // failure is silent it is difficult to tell, so we // read to see whether the write succeeded var successRegExp = /(^|; ?)__Secure-COOKIENAME=cookie-value(;|$)/; if (String([removed]).match(successRegExp)) { console.log('It worked!'); } else { console.error('It did not work, and we do not know why'); }
// All cookieStore methods are async, so you can `await` or `then`/`catch` await cookieStore.set({ name: "dw-test", value: 1, domain: 'davidwalsh.name', // Very far in the future! expires: Date.now() + Date.now() }); // Quick, naive set await cookieStore.set('key', 'value');