Closed hartmark closed 1 year ago
I have identified some issues still to resolve when I wrote some more tests. I will leave the PR open until I have fixed the remaining issues.
Remaining issues:
Alright, we have fixed the tests and fixed the implementation of IdempotentEndpointFilter.
This will be the solution we will be use in our application using minimal API.
@hartmark Thank you for your time and effort, and sorry for the delayed response 🙏
@hartmark Thank you for your time and effort, and sorry for the delayed response 🙏
No worries, life happens sometimes 😀
Any feedback on the PR yet?
@hartmark Thank you for your effort and time 🙏 . The IdempotentAPI.MinimalAPI is introduced in Release 2.1.0. The Endpoint filter is renamed to IdempotentAPIEndpointFilter
.
app.MapPost("/example",
([FromQuery] string yourParam) =>
{
return Results.Ok(new ResponseDTOs());
})
.AddEndpointFilter<IdempotentAPIEndpointFilter>();
Nice! 🎉
Is the nugget updated with the latest code now?
@hartmark Yes, NuGet libraries v2.1.0 has the latest code.
We have a minimal API and we wanted to use this nugget, but it seems MVC action filters isn't supported so we have used EndpointFilters that was added in .NET 7.
To make use of the endpoint filter you just need to add
.AddEndpointFilter<IdempotentEndpointFilter>()
We cannot decorate the action with any attribute so we inject IdempotencyAttributeFilter, And IdempotentEndpointFilter uses this injected instance. So we will have same settings for all endpoints with this implementation.
We will continue use this implementation in our application and haven't tested every different combinations of calls yet, but the preliminary testing looks alright.
One way forward for this nuget would be to make an abstraction layer that the endpoint filtering in minimal API can interface with instead of do the magic hackery found in IdempotentEndpointFilter
Do anyone have any comments and/or suggestions for our implementation?