private async Task GetStringContentAsync()

in src/Microsoft.Azure.WebJobs.Extensions.Dapr/Bindings/Converters/DaprStateConverter.cs [135:149]


        private async Task<string> GetStringContentAsync(DaprStateAttribute input, CancellationToken cancellationToken)
        {
            DaprStateRecord stateRecord = await this.GetStateRecordAsync(input, cancellationToken);

            if (stateRecord.ContentStream.Length == 0)
            {
                throw new DaprException(
                HttpStatusCode.NotFound,
                ErrorCodes.ErrNoContent,
                $"Failed getting state with key {input.Key} from state store {input.StateStore}: state {input.Key} not found.");
            }

            var contentJson = await JsonDocument.ParseAsync(stateRecord.ContentStream);
            return JsonSerializer.Serialize(contentJson, JsonUtils.DefaultSerializerOptions);
        }