Skip to content

Instantly share code, notes, and snippets.

@bjartwolf
Last active August 29, 2015 14:00
Show Gist options
  • Save bjartwolf/3e88102c956a245d50fe to your computer and use it in GitHub Desktop.
Save bjartwolf/3e88102c956a245d50fe to your computer and use it in GitHub Desktop.
all caps middleware
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Owin;
namespace AllCapsMiddleware
{
using AppFunc = Func<IDictionary<string,object>, Task>;
public class AllCaps
{
private readonly AppFunc _next;
public ResponseReadingMiddleware(AppFunc next)
{
this._next = next;
}
public async Task Invoke(IDictionary<string, object> env)
{
var ctx = new OwinContext(env);
ctx.Response.Body = new CapsStream(ctx.Response.Body);
await _next(env);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment