private async Task NotFound(HttpContext context, BlobMissingException e) { var s = "The specified resource does not exist.\r\n" + e.Message; context.Response.StatusCode = 404; context.Response.ContentType = "text/plain; charset=utf-8"; var bytes = Encoding.UTF8.GetBytes(s); context.Response.ContentLength = bytes.Length; await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); }
private async Task NotFound(HttpContext context, BlobMissingException e) { GlobalPerf.Singleton.IncrementCounter("http_404"); // We allow 404s to be cached, but not 403s or license errors var s = "The specified resource does not exist.\r\n" + e.Message; context.Response.StatusCode = 404; context.Response.ContentType = "text/plain; charset=utf-8"; var bytes = Encoding.UTF8.GetBytes(s); context.Response.ContentLength = bytes.Length; await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); }