Merge pull request #29927 from timdeschryver/docs/http-context
docs: fix feature snippetpull/29945/head
commit
4b0e88e82b
|
@ -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`:
|
||||
|
||||
|
|
|
@ -153,13 +153,14 @@ var app = builder.Build();
|
|||
|
||||
app.MapGet("/long-running-stream", async (HttpContext context) =>
|
||||
{
|
||||
var feature = httpContext.Features.Get<IHttpMinRequestBodyDataRateFeature>();
|
||||
var feature = context.Features.Get<IHttpMinRequestBodyDataRateFeature>();
|
||||
if (feature != null)
|
||||
{
|
||||
feature.MinDataRate = null;
|
||||
}
|
||||
|
||||
// Read long-running stream from request body.
|
||||
// await and read long-running stream from request body.
|
||||
await Task.Yield();
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
|
Loading…
Reference in New Issue