예제 #1
0
 public AsyncApiMiddleware(RequestDelegate next, IOptions <AsyncApiOptions> options, IAsyncApiDocumentProvider asyncApiDocumentProvider, IAsyncApiDocumentSerializer asyncApiDocumentSerializer)
 {
     _next = next;
     _asyncApiDocumentProvider   = asyncApiDocumentProvider;
     _asyncApiDocumentSerializer = asyncApiDocumentSerializer;
     _options = options.Value;
 }
예제 #2
0
        private static async Task RespondWithAsyncApiSchemaJson(HttpResponse response, AsyncApiSchema.v2.AsyncApiDocument asyncApiSchema, IAsyncApiDocumentSerializer asyncApiDocumentSerializer, AsyncApiOptions options)
        {
            var asyncApiSchemaJson = asyncApiDocumentSerializer.Serialize(asyncApiSchema, options);

            response.StatusCode  = (int)HttpStatusCode.OK;
            response.ContentType = asyncApiDocumentSerializer.ContentType;

            await response.WriteAsync(asyncApiSchemaJson);
        }