Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[OData] /odata/v1/orders() gives 400 Bad Request "Unspecified API version" #911

Copy link
Copy link
Closed
@dnperfors

Description

@dnperfors
Issue body actions

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When trying to request a specific item, for example a product in de ODataBasicExample, but not providing a key: GET ~/api/v1/orders(), the service returns the following:

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
Date: Tue, 15 Nov 2022 11:30:37 GMT
Server: Kestrel
Transfer-Encoding: chunked

{
  "type": "https://docs.api-versioning.org/problems#unspecified",
  "title": "Unspecified API version",
  "status": 400,
  "detail": "An API version is required, but was not specified.",
  "Code": "ApiVersionUnspecified",
  "traceId": "00-93b92d7cb1971c4932902abcc9d4ea8d-93ab6594370d9afd-00"
}

Expected Behavior

I would expect (and removing versioning from the example confirms this) a 404 Not Found.

Steps To Reproduce

As an extra test I made a simple example here: https://github.com/dnperfors/eLibrary

The following requests give the following responses:

Project Request Response
eLibrary.OData /odata/books 200 Ok -> List with books
eLibrary.OData /odata/books() 404 Not Found
eLibrary.OData /odata/books(1) 200 Ok -> single book
eLibrary.OData.Versioning /odata/v1/books 200 Ok -> List with books
eLibrary.OData.Versioning /odata/v1/books() 400 Bad Request --> "Unspecified API version"
eLibrary.OData.Versioning /odata/v1/books(1) 200 Ok -> single book

Exceptions (if any)

No response

.NET Version

6.0.300

Anything else?

Asp.Versioning.OData.ApiExplorer Version: 6.2.1

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.