79777352

Date: 2025-09-28 13:33:44
Score: 2
Natty:
Report link

You can get the ApiVersion in the endpoint

To do this, use httpContext.GetRequestedApiVersion();

https://github.com/dotnet/aspnet-api-versioning/wiki/Accessing-Version-Information

Example:

app.MapPost("/create", ... (HttpContext httpContext ...) =>
{
    ApiVersion apiVersion = httpContext.GetRequestedApiVersion();
    ...
});
Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: user31342728