Skip to content

Commit

Permalink
Fix Username -> UUID lookup to responde with 500 instead of 404
Browse files Browse the repository at this point in the history
Looks like Mojang changed their API and now responds with
404 themself instead of 204.
  • Loading branch information
SpraxDev committed Mar 23, 2023
1 parent 4369a50 commit 73698e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/mojang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function fetchUUID(username: string, at?: number): Promise<Minecraf

httpGet(`https://api.mojang.com/users/profiles/minecraft/${cleanUsername}${at != undefined ? `?at=${at}` : ''}`)
.then((result) => {
if (result.res.status == 204) return resolve(null);
if (result.res.status == 204 || result.res.status == 404) return resolve(null);

if (result.res.status == 200) {
return resolve(JSON.parse(result.body.toString('utf-8')));
Expand Down

0 comments on commit 73698e5

Please sign in to comment.