From 021ce04bdec3976f6813edae6f111c3125b87f8a Mon Sep 17 00:00:00 2001 From: Mark Rendle Date: Sun, 29 Sep 2013 23:48:25 +0100 Subject: [PATCH] Added new Fix's Application.Run signature --- packaging/nuspec/Simple.Web.nuspec | 1 + src/Simple.Web/Application.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/packaging/nuspec/Simple.Web.nuspec b/packaging/nuspec/Simple.Web.nuspec index 7a3ca16..1e35bc2 100644 --- a/packaging/nuspec/Simple.Web.nuspec +++ b/packaging/nuspec/Simple.Web.nuspec @@ -16,6 +16,7 @@ + diff --git a/src/Simple.Web/Application.cs b/src/Simple.Web/Application.cs index 77a5754..ff5786c 100644 --- a/src/Simple.Web/Application.cs +++ b/src/Simple.Web/Application.cs @@ -54,6 +54,20 @@ public static Task Run(IDictionary env) .ContinueWith(t => WriteResponse(t, context, env)).Unwrap(); } + public static Task Run(IDictionary env, Func next) + { + var context = new OwinContext(env); + var task = Run(context); + + if (task == null) + { + return next(); + } + + return task + .ContinueWith(t => WriteResponse(t, context, env)).Unwrap(); + } + private static Func ErrorHandler(string message) { return stream =>