OData / OData/AspNetCoreOData

OData endpoints with "search" in the route don't work

Open
#388 4 comments 0 reactions 1 assignee View on GitHub

@xuzhg is already working on this.

Since Nov 23, 2021.

followup investigated
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Any OData endpoint with "search" as the final URL segment returns 404 upon making any request.

An action such as this returns 404:

[EnableQuery]
[ODataAttributeRouting]
[HttpGet("~/api/odata/search")]
public IActionResult OData() {
    // return dataset
}

Other routes such as ~/api/odata/searc, ~/api/odata/testsearch, or ~/api/odata/search/test all work as expected, this only occurs when "search" is the final URL segment.

EDIT:

After some further investigation this appears to be related to the name of the entity set. When the entity set is added with the name all lowercase, the endpoint works as expected. If the first letter of the name is capitalised, the route does not work.

builder.EntitySet<Search>("Search"); // doesn't work
builder.EntitySet<Search>("search"); // works

I have not seen this behaviour with other entity sets, they work regardless of the name case.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.