Added ReadAsBytes extension and bumped nuget version.
This commit is contained in:
parent
fcbaaf133c
commit
e4c9b95fa3
@ -52,5 +52,29 @@ namespace MontoyaTech.Rest.Net
|
|||||||
return default(T);
|
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>
|
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
|
||||||
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
<Version>1.0.6</Version>
|
<Version>1.0.7</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json">
|
<PackageReference Include="Newtonsoft.Json">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user