in src/Microsoft.Azure.WebJobs.Extensions.Dapr/Services/DaprServiceClient.cs [118:146]
public async Task<DaprStateRecord> GetStateAsync(
string? daprAddress,
string stateStore,
string key,
CancellationToken cancellationToken)
{
try
{
this.EnsureDaprAddress(ref daprAddress);
var uri = $"{daprAddress}/v1.0/state/{stateStore}/{key}";
var response = await this.daprClient.GetAsync(this.stateInputLogger, uri, cancellationToken);
Stream contentStream = await response.Content.ReadAsStreamAsync();
string? eTag = response.Headers.ETag?.Tag;
return new DaprStateRecord(key, contentStream, eTag);
}
catch (Exception ex)
{
if (ex is DaprException || ex is DaprSidecarNotPresentException)
{
throw;
}
throw new DaprException(HttpStatusCode.InternalServerError, ErrorCodes.ErrDaprRequestFailed, "An error occurred while getting state.", ex);
}
}