Esempio n. 1
0
        /// <summary>
        /// Send request and return serialized response
        /// </summary>
        public async Task <TRes> GetResultAsync(CancellationToken cancellationToken)
        {
            var resp = await GetResponseAsync(cancellationToken);

            TRes resultObject;

            try
            {
                resultObject = (TRes)await ResponseProcessing.DeserializeContent(
                    _returnType,
                    resp.Content,
                    resp.StatusCode);
            }
            catch (Exception e)
            {
                throw new ResponseProcessingException(e);
            }

            return(resultObject);
        }
Esempio n. 2
0
        /// <inheritdoc />
        public override async Task <CallDetails <TRes> > GetDetailedAsync(CancellationToken cancellationToken)
        {
            var details = await base.GetDetailedAsync(cancellationToken);

            object respContent;

            try
            {
                respContent = await ResponseProcessing.DeserializeContent(
                    _returnType,
                    details.ResponseMessage.Content,
                    details.ResponseMessage.StatusCode);
            }
            catch (Exception e)
            {
                throw new DetailedResponseProcessingException <CallDetails <TRes> >(details, e);
            }

            details.ResponseContent = (TRes)respContent;

            return(details);
        }