当我写回复时,Katana会跳过发送Elapsed-Time响应头.在我第一次写入流之前,如何让它为我设置标题?
public override async Task Invoke(IOwinContext context)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
await Next.Invoke(context);
stopwatch.Stop();
context.Response.Headers.Add("Elapsed-Time", new[] {stopwatch.ElapsedMilliseconds.ToString()});
}
Run Code Online (Sandbox Code Playgroud)
public override async Task Invoke(IOwinContext context)
{
await context.Response.WriteAsync("test");
}
Run Code Online (Sandbox Code Playgroud)