public override async Task Invoke(IOwinContext context) { IContentFormatter contentFormatter = context.GetDependencyResolver().Resolve <IContentFormatter>(); IAppMetadataProvider appMetadataProvider = context.GetDependencyResolver().Resolve <IAppMetadataProvider>(); context.Response.ContentType = "application/json; charset=utf-8"; await context.Response.WriteAsync(contentFormatter.Serialize(await appMetadataProvider.GetAppMetadata()), context.Request.CallCancelled); }
public override async Task Invoke(IOwinContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } IContentFormatter contentFormatter = context.GetDependencyResolver().Resolve <IContentFormatter>(); IAppMetadataProvider appMetadataProvider = context.GetDependencyResolver().Resolve <IAppMetadataProvider>(); context.Response.ContentType = "application/json; charset=utf-8"; await context.Response.WriteAsync(contentFormatter.Serialize(await appMetadataProvider.GetAppMetadata().ConfigureAwait(false)), context.Request.CallCancelled).ConfigureAwait(false); }
public async Task Invoke(HttpContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } IContentFormatter contentFormatter = context.RequestServices.GetService <IContentFormatter>(); IAppMetadataProvider appMetadataProvider = context.RequestServices.GetService <IAppMetadataProvider>(); context.Response.ContentType = "application/json; charset=utf-8"; await context.Response.WriteAsync(contentFormatter.Serialize(await appMetadataProvider.GetAppMetadata().ConfigureAwait(false)), context.RequestAborted).ConfigureAwait(false); }