Exemple #1
0
        /// <summary>
        /// 格式化Consul Api写入结果
        /// </summary>
        /// <param name="response"></param>
        /// <returns></returns>
        internal static ConsulApiWriteResult formatConsulApiWriteResult(this HttpResponseMessage response)
        {
            var writeResult = new ConsulApiWriteResult();

            writeResult.StatusCode = response.StatusCode;

            return(writeResult);
        }
Exemple #2
0
        /// <summary>
        /// 格式化Consul Api写入结果
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="response"></param>
        /// <returns></returns>
        internal static async Task <ConsulApiWriteResult <string> > formatConsulApiWriteResultAsync(this HttpResponseMessage response)
        {
            var writeResult = new ConsulApiWriteResult <string>();

            writeResult.StatusCode = response.StatusCode;

            if (response.IsSuccessStatusCode)
            {
                writeResult.ResponseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
            }

            return(writeResult);
        }