Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Jan 31, 2024
1 parent b14e722 commit c755c64
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class Client {
const response = await this.#fetch("1.1/comment-check", comment.toJSON());
return await response.text() == "false"
? CheckResult.ham
: response.headers.get("X-akismet-pro-tip") == "discard" ? CheckResult.pervasiveSpam : CheckResult.spam;
: response.headers.get("x-akismet-pro-tip") == "discard" ? CheckResult.pervasiveSpam : CheckResult.spam;
}

/**
Expand Down Expand Up @@ -117,16 +117,16 @@ export class Client {
for (const item of value) body.set(`${key}[${index++}]`, item);
}

const response = await fetch(new URL(endpoint, this.baseUrl), {method: "POST", headers: {"User-Agent": this.userAgent}, body});
const response = await fetch(new URL(endpoint, this.baseUrl), {method: "POST", headers: {"user-agent": this.userAgent}, body});
if (!response.ok) throw Error(`${response.status} ${response.statusText}`);

if (response.headers.has("X-akismet-alert-code")) {
const code = response.headers.get("X-akismet-alert-code") ?? "";
throw Object.assign(Error(response.headers.get("X-akismet-alert-msg") ?? ""), {name: code ? `AkismetError #${code}` : "AkismetError"});
if (response.headers.has("x-akismet-alert-code")) {
const code = response.headers.get("x-akismet-alert-code") ?? "";
throw Object.assign(Error(response.headers.get("x-akismet-alert-msg") ?? ""), {name: code ? `AkismetError #${code}` : "AkismetError"});
}

if (response.headers.has("X-akismet-debug-help"))
throw Object.assign(Error(response.headers.get("X-akismet-debug-help") ?? ""), {name: "AkismetError"});
if (response.headers.has("x-akismet-debug-help"))
throw Object.assign(Error(response.headers.get("x-akismet-debug-help") ?? ""), {name: "AkismetError"});

return response;
}
Expand Down

0 comments on commit c755c64

Please sign in to comment.