davidmbillie / Hot-Potato

ASP.NET Core proxy that will validate an API's conformance to an OpenAPI spec.
MIT No Attribution
6 stars 1 forks source link

Consider deprecating HotPotatoMiddleware in favor of a default HTTP handler #5

Open lambchop4prez opened 1 year ago

lambchop4prez commented 1 year ago

I wanted to open this up to start the discussion. I may mock up a quick POC to show what I mean.

Basically, I think we aren't quite using the ASPNET Core middleware in the way that it was originally intended. From my understanding the middleware is meant to inspect and act on requests before they make it to their handler. With the HotPotatoMiddleware, the request is basically hijacked and doesn't make it to the handler. I don't think this is necessarily a problem, especially since it works.

The way I'm thinking of it, we can create a base HotPotatoController to act as a default handler (i.e. it will capture all requests that aren't for /cookies or /results). This controller would have the IProxy injected and will basically have all of the same functionality as HotPotatoMiddleware.

This may also help with using this with TestServer, no matter what design we go with I want to make sure we have better support for that.