Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Commit

Permalink
Fixes issue #2131 with XmlProcessor
Browse files Browse the repository at this point in the history
When the model passed to CreateResponse is null don't try to serialize
it as XML, effectively pass an empty body.
  • Loading branch information
phoenixx authored and thecodejunkie committed Dec 14, 2015
1 parent e716532 commit 36617b5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Nancy/Responses/Negotiation/XmlProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ private static Response CreateResponse(dynamic model, ISerializer serializer)
{
return new Response
{
Contents = stream => serializer.Serialize("application/xml", model, stream),
Contents = stream =>
{
if (model != null)
{
serializer.Serialize("application/xml", model, stream);
}
},
ContentType = "application/xml",
StatusCode = HttpStatusCode.OK
};
Expand Down

0 comments on commit 36617b5

Please sign in to comment.