diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-09-10 08:17:28 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-09-10 08:17:28 -0700 |
commit | 51070c061fc7eaa15d9281878da9400dd0260b59 (patch) | |
tree | b5ef4752bd9e2fa0cf4a99cd833c81b8beffde18 /src/DotNetOAuth/Messaging/Response.cs | |
parent | 32ac38940a40a70c171eedc72b4aacdbba692279 (diff) | |
download | DotNetOpenAuth-51070c061fc7eaa15d9281878da9400dd0260b59.zip DotNetOpenAuth-51070c061fc7eaa15d9281878da9400dd0260b59.tar.gz DotNetOpenAuth-51070c061fc7eaa15d9281878da9400dd0260b59.tar.bz2 |
Much better test coverage.
Diffstat (limited to 'src/DotNetOAuth/Messaging/Response.cs')
-rw-r--r-- | src/DotNetOAuth/Messaging/Response.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/DotNetOAuth/Messaging/Response.cs b/src/DotNetOAuth/Messaging/Response.cs index 68950ff..6413e68 100644 --- a/src/DotNetOAuth/Messaging/Response.cs +++ b/src/DotNetOAuth/Messaging/Response.cs @@ -25,6 +25,14 @@ namespace DotNetOAuth.Messaging { /// </remarks>
public class Response {
/// <summary>
+ /// Initializes an instance of the <see cref="Response"/> class.
+ /// </summary>
+ internal Response() {
+ Status = HttpStatusCode.OK;
+ Headers = new WebHeaderCollection();
+ }
+
+ /// <summary>
/// Gets the headers that must be included in the response to the user agent.
/// </summary>
/// <remarks>
@@ -37,7 +45,7 @@ namespace DotNetOAuth.Messaging { /// <summary>
/// Gets the body of the HTTP response.
/// </summary>
- public byte[] Body { get; internal set; }
+ public string Body { get; internal set; }
/// <summary>
/// Gets the HTTP status code to use in the HTTP response.
@@ -62,11 +70,9 @@ namespace DotNetOAuth.Messaging { HttpContext.Current.Response.Clear();
HttpContext.Current.Response.StatusCode = (int)this.Status;
MessagingUtilities.ApplyHeadersToResponse(this.Headers, HttpContext.Current.Response);
- if (this.Body != null && this.Body.Length > 0) {
- HttpContext.Current.Response.OutputStream.Write(this.Body, 0, this.Body.Length);
- HttpContext.Current.Response.OutputStream.Flush();
+ if (this.Body != null) {
+ HttpContext.Current.Response.Output.Write(Body);
}
- HttpContext.Current.Response.OutputStream.Close();
HttpContext.Current.Response.End();
}
}
|