Skip to content

Instantly share code, notes, and snippets.

@bvanderveen
Created August 16, 2011 00:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvanderveen/1148200 to your computer and use it in GitHub Desktop.
Save bvanderveen/1148200 to your computer and use it in GitHub Desktop.
Set a default content-type with an OWIN middleware
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