и хочу, чтобы HttpGet был похож на
Код: Выделить всё
person? x = await _httpClient.Get
("url");
Как это сделать правильно?
У меня есть httpclient с get, например
Код: Выделить всё
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();
}
}
Но все же, если я возвращаю NULL из API, он выдает
Код: Выделить всё
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.'
Какой лучший подход для этого? или я что-то упускаю и это неправильно?
Спасибо и с уважением!
Подробнее здесь: https://stackoverflow.com/questions/757 ... -like-this