Last active
August 29, 2015 14:00
-
-
Save bjartwolf/3e88102c956a245d50fe to your computer and use it in GitHub Desktop.
all caps middleware
This file contains hidden or 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.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