Skip to content

Commit

Permalink
Fixes issue NancyFx#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 fxbit committed Aug 19, 2016
1 parent e18d5d6 commit a684558
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 a684558

Please sign in to comment.