1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 19:59:37 +00:00

fix: use .has instead of .get

This commit is contained in:
James Cook 2023-09-10 13:02:05 +01:00
parent 17549a4f24
commit ffe3e24bbd
2 changed files with 2 additions and 2 deletions

View file

@ -41,7 +41,7 @@ export class ParentClient extends BaseClient {
headers: headers, headers: headers,
credentials: undefined, credentials: undefined,
}); });
if (response.status != 302 || !response.headers.get("set-cookie")) { if (response.status != 302 || !response.headers.has("set-cookie")) {
throw new Error( throw new Error(
"Unauthenticated: ClassCharts returned an error: " + "Unauthenticated: ClassCharts returned an error: " +
response.status + response.status +

View file

@ -41,7 +41,7 @@ export class StudentClient extends BaseClient {
body: formData, body: formData,
redirect: "manual", 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 await request.body?.cancel(); // Make deno tests happy by closing the body, unsure whether this is needed for the actual library
throw new Error( throw new Error(
"Unauthenticated: ClassCharts didn't return authentication cookies", "Unauthenticated: ClassCharts didn't return authentication cookies",