Skip to content

Commit

Permalink
Update async addCookies for JS examples
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed May 13, 2024
1 parent f87b531 commit 9c872c9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions examples/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function () {
const day = 60*60*24;
const dayAfter = unixTimeSinceEpoch+day;
const dayBefore = unixTimeSinceEpoch-day;
context.addCookies([
await context.addCookies([
// this cookie expires at the end of the session
{
name: 'testcookie',
Expand Down Expand Up @@ -82,25 +82,25 @@ export default async function () {
});

// let's add more cookies to filter by urls.
context.addCookies([
await context.addCookies([
{
name: 'foo',
value: '42',
sameSite: 'Strict',
url: 'http://foo.com'
name: "foo",
value: "42",
sameSite: "Strict",
url: "http://foo.com",
},
{
name: 'bar',
value: '43',
sameSite: 'Lax',
url: 'https://bar.com'
name: "bar",
value: "43",
sameSite: "Lax",
url: "https://bar.com",
},
{
name: 'baz',
value: '44',
sameSite: 'Lax',
url: 'https://baz.com'
}
name: "baz",
value: "44",
sameSite: "Lax",
url: "https://baz.com",
},
]);
cookies = await context.cookies("http://foo.com", "https://baz.com");
check(cookies.length, {
Expand Down

0 comments on commit 9c872c9

Please sign in to comment.