Created
August 16, 2011 00:25
-
-
Save bvanderveen/1148200 to your computer and use it in GitHub Desktop.
Set a default content-type with an OWIN middleware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Gate; | |
using Gate.Kayak; | |
using Nancy.Hosting.Owin; | |
using Gate.Helpers; | |
namespace KayakNancyTest01 | |
{ | |
public class Startup | |
{ | |
public static void Configuration(IAppBuilder builder) | |
{ | |
builder | |
.RescheduleCallbacks() | |
.Use(del => (env, result, fault) => { | |
del(env, (status, headers, body) => { | |
if (!headers.ContainsKey("Content-Type") || string.IsNullOrEmpty(headers["Content-Type"])) | |
headers["Content-Type"] = "text/html"; | |
result(status, headers, body); | |
}, fault); | |
}) | |
.RunNancy(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment