question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple route attributes

See original GitHub issue

Hello, I’m trying this library for the first time, I immediately ran into this limit Duplicate 'HttpGet' attribute while the asp.net core controllers allow it

[HttpGet("/api/session/me")]
[HttpGet("/api/session/")] // <--- Duplicate 'HttpGet' attribute
[AllowAnonymous]
public class SessionEndpoint : Endpoint<EmptyRequest, CurrentSessionResponse>
{
    public override async Task HandleAsync(EmptyRequest request, CancellationToken cancellationToken)
    {
        var response = new CurrentSessionResponse
        {
            ...
        };

        await SendAsync(response, cancellation: cancellationToken).ConfigureAwait(false);
    }
}

is this a feature that will be supported?

thanks

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nefariuscommented, Aug 20, 2022

Looks good and simple to understand!

1reaction
dj-nitehawkcommented, May 23, 2022

it’s currently not supported atm with attributes. but available via routes() method as shown here: https://github.com/dj-nitehawk/FastEndpoints/blob/1c1ac25cd0f4e9e70c952f0f51cbb658271f6905/Web/[Features]/Customers/Create/Endpoint.cs#L39-L42

will look into supporting it in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

asp.net - Assigning multiple routes to the same controller or ...
Having 2 route attributes at the controller level works fine in a new RC1 application: [Produces("application/json")] ...
Read more >
Multiple Routes - Mastering ASP.NET Web API [Book]
Run the application to see the multiple routes in action. You would verify the multiple routes are working by accessing the endpoints on...
Read more >
Routing to controller actions in ASP.NET Core
Attribute routing provides fine-grained control to make the ID required for some actions and not for others. By convention, the documentation ...
Read more >
Route Attribute In ASP.NET MVC
In this article I explain the basic usage of route attribute and how ... You can also write multiple routes onthe same action...
Read more >
Web API Routing
Learn about Web API routing here. Web API supports two types of routing: Convention-based Routing and Attribute Routing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found