summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-11-02 09:26:06 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-11-02 09:26:06 -0700
commit94a7276b4aad80faa0ccbe8d754f63d8d1d7c9fa (patch)
treed6f5242584ca06b923d113a2ad0c869fe2306d48 /src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
parent46ed7ca81f78f70557ee9d02cdc69608d6fe1dc9 (diff)
downloadDotNetOpenAuth-94a7276b4aad80faa0ccbe8d754f63d8d1d7c9fa.zip
DotNetOpenAuth-94a7276b4aad80faa0ccbe8d754f63d8d1d7c9fa.tar.gz
DotNetOpenAuth-94a7276b4aad80faa0ccbe8d754f63d8d1d7c9fa.tar.bz2
Fixes AsHttpResposneMessage() exception when response has no stream.
Fixes #226
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs')
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
index ab56d8b..b266a62 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
@@ -171,9 +171,10 @@ namespace DotNetOpenAuth.Messaging {
/// <param name="outgoingResponse">The response to send to the user agent.</param>
/// <returns>The <see cref="HttpResponseMessage"/> instance to be returned by the Web API method.</returns>
public static HttpResponseMessage AsHttpResponseMessage(this OutgoingWebResponse outgoingResponse) {
- HttpResponseMessage response = new HttpResponseMessage(outgoingResponse.Status) {
- Content = new StreamContent(outgoingResponse.ResponseStream)
- };
+ HttpResponseMessage response = new HttpResponseMessage(outgoingResponse.Status);
+ if (outgoingResponse.ResponseStream != null) {
+ response.Content = new StreamContent(outgoingResponse.ResponseStream);
+ }
var responseHeaders = outgoingResponse.Headers;
foreach (var header in responseHeaders.AllKeys) {