oskardudycz / EventSourcing.NetCore

Examples and Tutorials of Event Sourcing in .NET
https://event-driven.io
Creative Commons Attribution Share Alike 4.0 International
3.38k stars 512 forks source link

ECommerce Sample Payments API has conflicting delete routes #66

Open BradKnowles opened 3 years ago

BradKnowles commented 3 years ago

When attempting to execute action DiscardPayment, this error message is returned:

{
    "StatusCode": 500,
    "Error": "The request matched multiple endpoints. Matches: \r\n\r\nPayments.Api.Controllers.PaymentsController.DiscardPayment (Payments.Api)\r\nPayments.Api.Controllers.PaymentsController.TimeoutPayment (Payments.Api)"
}

Both actions are decorated with the same [HttpDelete("{id}")] attribute and ASP.NET doesn't know which to choose.

https://github.com/oskardudycz/EventSourcing.NetCore/blob/ac8457070b96aeb5e08e10fb2567d7e726dd5a20/Sample/ECommerce/Payments/Payments.Api/Controllers/PaymentsController.cs#L64-L92

BradKnowles commented 3 years ago

I didn't attempt a PR on this one as I don't know how you'd like to solve it. Do you want DiscardPayment and TimeoutPayment to be part of the route? Or are you looking for a more elegant solution where ASP.NET figures out which action to execute based on the request body?