Added ReadAsBytes extension and bumped nuget version.
This commit is contained in:
		@@ -52,5 +52,29 @@ namespace MontoyaTech.Rest.Net
 | 
			
		||||
                return default(T);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Reads the content of a HttpListenerRequest as a byte array.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="request"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static byte[] ReadAsBytes(this HttpListenerRequest request)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                using (var input = request.InputStream)
 | 
			
		||||
                {
 | 
			
		||||
                    using (var stream = new MemoryStream())
 | 
			
		||||
                    {
 | 
			
		||||
                        input.CopyTo(stream);
 | 
			
		||||
                        return stream.ToArray();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
            {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
    <AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
 | 
			
		||||
    <RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
 | 
			
		||||
    <GenerateDocumentationFile>True</GenerateDocumentationFile>
 | 
			
		||||
    <Version>1.0.6</Version>
 | 
			
		||||
    <Version>1.0.7</Version>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
   <PackageReference Include="Newtonsoft.Json">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user