From 347a8c048089a8e3208fb9004b7aeaa60c21d08b Mon Sep 17 00:00:00 2001 From: Jonathan Channon Date: Tue, 26 Jul 2016 19:53:51 +0100 Subject: [PATCH] check routeresult is Response --- .../Responses/Negotiation/DefaultResponseNegotiator.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Nancy/Responses/Negotiation/DefaultResponseNegotiator.cs b/src/Nancy/Responses/Negotiation/DefaultResponseNegotiator.cs index c5d545b51f..cb217662d6 100644 --- a/src/Nancy/Responses/Negotiation/DefaultResponseNegotiator.cs +++ b/src/Nancy/Responses/Negotiation/DefaultResponseNegotiator.cs @@ -80,6 +80,12 @@ private static bool TryCastResultToResponse(dynamic routeResult, out Response re var targetType = routeResult.GetType(); var responseType = typeof(Response); + if (routeResult is Response) + { + response = (Response)routeResult; + return true; + } + var methods = responseType.GetMethods(BindingFlags.Public | BindingFlags.Static); foreach (var method in methods)