Skip to content

Incomplete response when incorrect version requested #876

Closed
@bordecal

Description

@bordecal

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

We use this library for versioning of a .NET 6.0 REST API for which supporting forced update of client application is a key requirement. Unfortunately, after update to v6.0.0, it seems that the information that would help the client determine that there is a version mismatch is no longer exposed in the HTTP response.

The change in status code from 400 to 404 is a minor inconvenience that we can work around. However, when an incorrect API version is requested, there does not seem to be any information returned in the response that would help identify the problem:

  • The response does not include problem details specifying that the cause of the 404 was a request for an unsupported API version.
  • The api-supported-versions is absent from the response even if ApiVersioningOptions.ReportApiVersions has been set to true.

This behaviour can be easily reproduced using the BasicExample at https://github.com/dotnet/aspnet-api-versioning/tree/main/examples/AspNetCore/WebApi/BasicExample:

Expected Behavior

When an unsupported API version is requested, a problem details response identifying the problem should be returned. If supported version reporting has been enabled via ApiVersioningOptions.ReportApiVersions, an api-supported-versions header should be included in the response.

Steps To Reproduce

Run the BasicExample from this repo and request an unsupported API version (e.g.: https://localhost:5001/api/values?api-version=5.0).

Exceptions (if any)

No response

.NET Version

6.0.400

Anything else?

We see 400 responses with meaningful problem details when using v5.0.0 of this library with .NET 6.0, so this does not appear to be a .NET 6.0 issue.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions