From 2460bdd0ddc68603a01502ad37ea586b8a8be640 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:59:36 +0200 Subject: [PATCH 1/3] docs: fix feature snippet --- aspnetcore/fundamentals/use-http-context/samples/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/fundamentals/use-http-context/samples/Program.cs b/aspnetcore/fundamentals/use-http-context/samples/Program.cs index afb4936199..17421f075f 100644 --- a/aspnetcore/fundamentals/use-http-context/samples/Program.cs +++ b/aspnetcore/fundamentals/use-http-context/samples/Program.cs @@ -153,7 +153,7 @@ var app = builder.Build(); app.MapGet("/long-running-stream", async (HttpContext context) => { - var feature = httpContext.Features.Get(); + var feature = context.Features.Get(); if (feature != null) { feature.MinDataRate = null; From aee04aeb874aaa3e4a117ab272abf12db398d8fd Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:00:20 +0200 Subject: [PATCH 2/3] docs: fix highlight in thread safe snippet --- aspnetcore/fundamentals/use-http-context.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/fundamentals/use-http-context.md b/aspnetcore/fundamentals/use-http-context.md index e85639e644..6b0e0b6b26 100644 --- a/aspnetcore/fundamentals/use-http-context.md +++ b/aspnetcore/fundamentals/use-http-context.md @@ -185,7 +185,7 @@ This article primarily discusses using `HttpContext` in request and response flo The following sample logs GitHub branches when requested from the `/branch` endpoint: -[!code-csharp[](~/fundamentals/http-context/samples/6.x/HttpContextInBackgroundThread/Program.cs?highlight=26-45)] +[!code-csharp[](~/fundamentals/http-context/samples/6.x/HttpContextInBackgroundThread/Program.cs?highlight=26-46)] The GitHub API requires two headers. The `User-Agent` header is added dynamically by the `UserAgentHeaderHandler`: From ca628c4c7ecdbcf23a0e41e4c3ab7c3be5709272 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:05:18 +0200 Subject: [PATCH 3/3] docs: fix await warning in feature snippet --- aspnetcore/fundamentals/use-http-context/samples/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aspnetcore/fundamentals/use-http-context/samples/Program.cs b/aspnetcore/fundamentals/use-http-context/samples/Program.cs index 17421f075f..2a9b8d604d 100644 --- a/aspnetcore/fundamentals/use-http-context/samples/Program.cs +++ b/aspnetcore/fundamentals/use-http-context/samples/Program.cs @@ -159,7 +159,8 @@ app.MapGet("/long-running-stream", async (HttpContext context) => feature.MinDataRate = null; } - // Read long-running stream from request body. + // await and read long-running stream from request body. + await Task.Yield(); }); app.Run();