Skip to content

Commit

Permalink
fix LCClient.verifyUser
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EthanThatOneKid committed Jun 8, 2024
1 parent 436a581 commit 2427c30
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/lc/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export class LCClient implements LCClientInterface {
* verifyUser verifies the user by username.
*/
public async verifyUser(username: string): Promise<boolean> {
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;
}

Expand Down

0 comments on commit 2427c30

Please sign in to comment.