From ffe3e24bbdd1b3341bd3a2aa7d93d4c4258a4500 Mon Sep 17 00:00:00 2001 From: James Cook Date: Sun, 10 Sep 2023 13:02:05 +0100 Subject: [PATCH] fix: use .has instead of .get --- src/core/parentClient.ts | 2 +- src/core/studentClient.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/parentClient.ts b/src/core/parentClient.ts index 3a6ab65..b20882d 100644 --- a/src/core/parentClient.ts +++ b/src/core/parentClient.ts @@ -41,7 +41,7 @@ export class ParentClient extends BaseClient { headers: headers, credentials: undefined, }); - if (response.status != 302 || !response.headers.get("set-cookie")) { + if (response.status != 302 || !response.headers.has("set-cookie")) { throw new Error( "Unauthenticated: ClassCharts returned an error: " + response.status + diff --git a/src/core/studentClient.ts b/src/core/studentClient.ts index 000c857..464a22d 100644 --- a/src/core/studentClient.ts +++ b/src/core/studentClient.ts @@ -41,7 +41,7 @@ export class StudentClient extends BaseClient { body: formData, redirect: "manual", }); - if (request.status != 302 || !request.headers.get("set-cookie")) { + if (request.status != 302 || !request.headers.has("set-cookie")) { await request.body?.cancel(); // Make deno tests happy by closing the body, unsure whether this is needed for the actual library throw new Error( "Unauthenticated: ClassCharts didn't return authentication cookies",