Created
April 9, 2019 06:45
-
-
Save wullemsb/4fe7cd8fe952527335ce34a83b839a6d to your computer and use it in GitHub Desktop.
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
public class SchemaMiddleware | |
{ | |
private readonly RequestDelegate _next; | |
public SchemaMiddleware(RequestDelegate next) | |
{ | |
_next = next; | |
} | |
public async Task Invoke(HttpContext context, OrdersSchema schema) | |
{ | |
using (var printer = new SchemaPrinter(schema)) | |
{ | |
context.Response.ContentType = "application/text"; | |
context.Response.StatusCode = (int)HttpStatusCode.OK; | |
await context.Response.WriteAsync(printer.Print()); | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment