Updated scanner to infer when it has reached the end of results.
This commit is contained in:
@@ -10,9 +10,12 @@ public abstract class ApiClient(IHttpService http, ILogger logger, JsonSerialize
|
||||
{
|
||||
protected async Task<T> GetJsonAsync<T>(string url, CancellationToken cancellationToken = default)
|
||||
{
|
||||
string response = await http.GetStringAsync(url, cancellationToken);
|
||||
HttpStringResponse response = await http.GetAsync(url, cancellationToken);
|
||||
|
||||
return JsonSerializer.Deserialize<T>(response, json)
|
||||
if (response.Content is null)
|
||||
throw new Exception("No content to deserialize");
|
||||
|
||||
return JsonSerializer.Deserialize<T>(response.Content, json)
|
||||
?? throw new InvalidOperationException($"Failed to deserialize JSON to {typeof(T).Name} from {url}.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user