diff --git a/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs b/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs
index 6b10bdf..0405a7c 100644
--- a/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs
+++ b/Rest.Net/Rest.Net/Extensions/HttpListenerRequestExtensions.cs
@@ -52,5 +52,29 @@ namespace MontoyaTech.Rest.Net
return default(T);
}
}
+
+ ///
+ /// Reads the content of a HttpListenerRequest as a byte array.
+ ///
+ ///
+ ///
+ 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;
+ }
+ }
}
}
diff --git a/Rest.Net/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net/Rest.Net.csproj
index c5cc1d5..7aed3aa 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.6
+ 1.0.7