コード例 #1
0
 public AsyncApiMiddleware(RequestDelegate next, IOptions <AsyncApiOptions> options, IAsyncApiDocumentProvider asyncApiDocumentProvider, IAsyncApiDocumentSerializer asyncApiDocumentSerializer)
 {
     _next = next;
     _asyncApiDocumentProvider   = asyncApiDocumentProvider;
     _asyncApiDocumentSerializer = asyncApiDocumentSerializer;
     _options = options.Value;
 }
コード例 #2
0
ファイル: AsyncApiUiMiddleware.cs プロジェクト: nlunn/saunter
        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);
        }
コード例 #3
0
ファイル: AsyncApiMiddleware.cs プロジェクト: nlunn/saunter
        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);
        }
コード例 #4
0
        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);
        }