InvokeAsync Method
Definition
- Namespace
- Cuemon.AspNetCore.Http.Headers
- Assemblies
- Cuemon.AspNetCore.dll
InvokeAsync(HttpContext)
Invokes the middleware for the given HttpContext.
Adds the Vary: Accept response header just before the response starts.
public override Task InvokeAsync(HttpContext context)
Parameters
contextHttpContextThe current HttpContext.
Returns
- Task
A Task that represents the asynchronous operation of this middleware. The returned task completes when the remaining pipeline has finished processing.
Remarks
The header is appended using OnStarting(Func<Task>)
to ensure the header is present even if the response body is being streamed or the response
was started by downstream middleware. This signals to intermediaries and clients that the
response representation depends on the request's Accept header.