From 77a207abf6e98b56ca64f8e146fb02a297670688 Mon Sep 17 00:00:00 2001 From: Ethan Davidson <31261035+EthanThatOneKid@users.noreply.github.com> Date: Sat, 8 Jun 2024 07:16:26 -0700 Subject: [PATCH] fix LCClient.verifyUser (#60) For some reason, this request spontaneously required the headers `{ "priority": "u=0, i" }`. I figured this out by copying the fetch from the navigation tab and removing all of the options that aren't absolutely necessary. --- lib/lc/client.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/lc/client.ts b/lib/lc/client.ts index b84b351..734ae0e 100644 --- a/lib/lc/client.ts +++ b/lib/lc/client.ts @@ -18,7 +18,10 @@ export class LCClient implements LCClientInterface { * verifyUser verifies the user by username. */ public async verifyUser(username: string): Promise { - const response = await this.fetch(`https://leetcode.com/${username}/`); + const response = await this.fetch( + `https://leetcode.com/${username}/`, + { headers: { "priority": "u=0, i" } }, + ); return response.status === 200; }