Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Asherslab committed Jan 16, 2025
1 parent 55cb056 commit e53c7f1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public record UuidResponseDto(string Id, string Name);
{
//_httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");

var response = await _httpClient.PostAsJsonAsync(new Uri("https://api.mojang.com/profiles/minecraft"), new[] {username}, cancellationToken: token);
HttpResponseMessage response = await _httpClient.GetAsync(new Uri($"https://api.mojang.com/users/profiles/minecraft/{username}"), cancellationToken: token);
if (!response.IsSuccessStatusCode) return null;
var elements = await response.Content.ReadFromJsonAsync<List<UuidResponseDto>>(cancellationToken: token);
List<UuidResponseDto>? elements = await response.Content.ReadFromJsonAsync<List<UuidResponseDto>>(cancellationToken: token);
return elements?.FirstOrDefault()?.Id;
}

Expand Down

0 comments on commit e53c7f1

Please sign in to comment.