Added ReadToStream extension and bumped package version.
This commit is contained in:
parent
e4c9b95fa3
commit
16c42c1ef7
@ -76,5 +76,26 @@ namespace MontoyaTech.Rest.Net
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the content of a HttpListenerRequest to the given stream and returns whether or not it succeeded.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="stream"></param>
|
||||
/// <returns>Whether or not the read was successful.</returns>
|
||||
public static bool ReadToStream(this HttpListenerRequest request, Stream stream)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var input = request.InputStream)
|
||||
input.CopyTo(stream);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
|
||||
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Version>1.0.7</Version>
|
||||
<Version>1.0.8</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
|
Loading…
x
Reference in New Issue
Block a user