diff --git a/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs b/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs index 0405a7c..94bae3f 100644 --- a/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs +++ b/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs @@ -76,5 +76,26 @@ namespace MontoyaTech.Rest.Net return null; } } + + /// + /// Reads the content of a HttpListenerRequest to the given stream and returns whether or not it succeeded. + /// + /// + /// + /// Whether or not the read was successful. + public static bool ReadToStream(this HttpListenerRequest request, Stream stream) + { + try + { + using (var input = request.InputStream) + input.CopyTo(stream); + + return true; + } + catch + { + return false; + } + } } } diff --git a/Rest.Net/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net/Rest.Net.csproj index 7aed3aa..61d9465 100644 --- a/Rest.Net/Rest.Net/Rest.Net.csproj +++ b/Rest.Net/Rest.Net/Rest.Net.csproj @@ -14,7 +14,7 @@ MontoyaTech.Rest.Net MontoyaTech.Rest.Net True - 1.0.7 + 1.0.8