/// <summary>
        /// Gets the JSON.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <returns>The unverified JSON.</returns>
        /// <exception cref="WebServiceException">The response content does not use the JSON content type or the content is empty.</exception>
        public static async Task <string> GetJsonAsync(this HttpResponseMessage response)
        {
            if (!response.HasJson())
            {
                throw await HttpResponseMessageUtility.CreateWebServiceExceptionWithContentPreviewAsync(response, "The response does not have JSON content.").ConfigureAwait(false);
            }

            return(await response.Content.ReadAsStringAsync().ConfigureAwait(false));
        }
 private static Task <WebServiceException> CreateExceptionAsync(WebServiceResponseHandlerInfo info, string message)
 {
     if (info.IsContentRead)
     {
         return(Task.FromResult(HttpResponseMessageUtility.CreateWebServiceException(info.WebResponse, message)));
     }
     else
     {
         info.MarkContentAsRead();
         return(HttpResponseMessageUtility.CreateWebServiceExceptionWithContentPreviewAsync(info.WebResponse, message));
     }
 }