You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Microsoft.AspNetCore.Mvc.Versioning 5.1.0, the error responses contained an error code (e.g. ApiVersionUnspecified). When upgrading to Asp.Versioning 8.1.0, the documentation states that it is possible to retain the previous "Error Object" format (which I would expect to include the code property). However, even when using builder.Services.AddErrorObjects().AddProblemDetails(), there is no code property in the error response.
I'm seeing something like this:
{
"error": {
"message": "Unspecified API version",
"target": "Unspecified API version",
"innerError": {
"message": "An API version is required, but was not specified."
}
}
}
Expected Behavior
I expected the error response to match what is was in the older version (especially the code property):
{
"error": {
"code": "ApiVersionUnspecified",
"message": "An API version is required, but was not specified.",
"innerError": null
}
}
Is there an existing issue for this?
Describe the bug
When using Microsoft.AspNetCore.Mvc.Versioning 5.1.0, the error responses contained an error
code
(e.g.ApiVersionUnspecified
). When upgrading to Asp.Versioning 8.1.0, the documentation states that it is possible to retain the previous "Error Object" format (which I would expect to include thecode
property). However, even when usingbuilder.Services.AddErrorObjects().AddProblemDetails()
, there is nocode
property in the error response.I'm seeing something like this:
Expected Behavior
I expected the error response to match what is was in the older version (especially the
code
property):Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
8.0.204
Anything else?
I think this line of code is perhaps missing a not:
https://github.com/dotnet/aspnet-api-versioning/blob/main/src/AspNetCore/WebApi/src/Asp.Versioning.Http/Routing/EndpointProblem.cs#L28
The text was updated successfully, but these errors were encountered: