und ich möchte HttpGet wie
haben
Code: Select all
person? x = await _httpClient.Get
("url");
Wie mache ich das richtig?
Ich habe einen httpclient mit get wie zum Beispiel
Code: Select all
public async Task Get(string uri, int timeOut = 100)
{
using var response = await _httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri), linkedCts.Token);
return await response.Content.ReadFromJsonAsync();
}
}
Aber wenn ich NULL von der API zurückgebe, wird
ausgelöst
Code: Select all
The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.'
Was ist der beste Ansatz hierfür? Oder übersehe ich etwas und das ist nicht der richtige Weg?
Danke und Grüße!