Skip to content

Commit

Permalink
chore: apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Sep 26, 2023
1 parent b96cce6 commit 7662142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/runtime/utils.azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export function getAzureParsedCookiesFromHeaders(
) {
return [];
}
const azureCookies: Cookie[] = []
const azureCookies: Cookie[] = [];
for (const setCookieStr of splitCookiesString(setCookieHeader)) {
const setCookie = Object.entries(parse(setCookieStr));
if (setCookie.length === 0) {
continue
continue;
}
const [[key, value], ..._setCookieOptions] = setCookie;
const setCookieOptions = Object.fromEntries(
Expand All @@ -31,10 +31,10 @@ export function getAzureParsedCookiesFromHeaders(
expires: parseNumberOrDate(setCookieOptions.expires),
sameSite: setCookieOptions.samesite as "Lax" | "Strict" | "None",
maxAge: parseNumber(setCookieOptions.maxAge),
secure: setCookieStr.includes('Secure') ? true : undefined,
httpOnly: setCookieStr.includes('HttpOnly') ? true : undefined,
secure: setCookieStr.includes("Secure") ? true : undefined,
httpOnly: setCookieStr.includes("HttpOnly") ? true : undefined,
};
azureCookies.push(cookieObject)
azureCookies.push(cookieObject);
}
return azureCookies;
}
Expand Down
6 changes: 4 additions & 2 deletions test/unit/azure.utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ describe("getAzureParsedCookiesFromHeaders", () => {
).toMatchObject([]);
});
it("returns empty array if empty set-cookie header", () => {
expect(getAzureParsedCookiesFromHeaders({ "set-cookie": " " })).toMatchObject([]);
expect(
getAzureParsedCookiesFromHeaders({ "set-cookie": " " })
).toMatchObject([]);
});
it("returns single cookie", () => {
expect(
Expand Down Expand Up @@ -50,7 +52,7 @@ describe("getAzureParsedCookiesFromHeaders", () => {
expires: new Date("2024-03-24T09:13:27.000Z"),
path: "/",
sameSite: "Strict",
httpOnly: true
httpOnly: true,
},
]);
});
Expand Down

0 comments on commit 7662142

Please sign in to comment.