public AsyncApiMiddleware(RequestDelegate next, IOptions <AsyncApiOptions> options, IAsyncApiDocumentProvider asyncApiDocumentProvider, IAsyncApiDocumentSerializer asyncApiDocumentSerializer) { _next = next; _asyncApiDocumentProvider = asyncApiDocumentProvider; _asyncApiDocumentSerializer = asyncApiDocumentSerializer; _options = options.Value; }
public async Task Invoke(HttpContext context, IAsyncApiDocumentProvider asyncApiDocumentProvider, IAsyncApiDocumentSerializer asyncApiDocumentSerializer) { if (IsRequestingAsyncApiUi(context.Request)) { var asyncApiSchema = asyncApiDocumentProvider.GetDocument(); await RespondWithAsyncApiHtml(context.Response, asyncApiSchema, asyncApiDocumentSerializer); return; } await RespondWithProxiedResponse(context.Request, context.Response); }
public async Task Invoke(HttpContext context, IAsyncApiDocumentProvider asyncApiDocumentProvider, IAsyncApiDocumentSerializer asyncApiDocumentSerializer) { if (!IsRequestingAsyncApiSchema(context.Request)) { await _next(context); return; } var asyncApiSchema = asyncApiDocumentProvider.GetDocument(); await RespondWithAsyncApiSchemaJson(context.Response, asyncApiSchema, asyncApiDocumentSerializer); }
public async Task Invoke(HttpContext context, IAsyncApiDocumentProvider asyncApiDocumentProvider) { if (!IsRequestingAsyncApiUi(context.Request) && !IsRequestingAsyncApiUiAssets(context.Request)) { await _next(context); return; } if (IsRequestingAsyncApiUi(context.Request)) { var asyncApiSchema = asyncApiDocumentProvider.GetDocument(); await RespondWithAsyncApiHtml(context.Response, asyncApiSchema); return; } await RespondWithProxiedResponse(context.Request, context.Response); }