summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth/Messaging/Response.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOAuth/Messaging/Response.cs')
-rw-r--r--src/DotNetOAuth/Messaging/Response.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/DotNetOAuth/Messaging/Response.cs b/src/DotNetOAuth/Messaging/Response.cs
index 81089ed..8a7c2e1 100644
--- a/src/DotNetOAuth/Messaging/Response.cs
+++ b/src/DotNetOAuth/Messaging/Response.cs
@@ -6,6 +6,7 @@
namespace DotNetOAuth.Messaging {
using System;
+ using System.IO;
using System.Net;
using System.Web;
@@ -33,6 +34,19 @@ namespace DotNetOAuth.Messaging {
}
/// <summary>
+ /// Initializes a new instance of the <see cref="Response"/> class
+ /// based on the contents of an <see cref="HttpWebResponse"/>.
+ /// </summary>
+ /// <param name="response">The <see cref="HttpWebResponse"/> to clone.</param>
+ internal Response(HttpWebResponse response) {
+ this.Status = response.StatusCode;
+ this.Headers = response.Headers;
+ using (StreamReader reader = new StreamReader(response.GetResponseStream())) {
+ this.Body = reader.ReadToEnd();
+ }
+ }
+
+ /// <summary>
/// Gets the headers that must be included in the response to the user agent.
/// </summary>
/// <remarks>