utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
290 stars 37 forks source link

Makes httpmw.DefaultChain configurable to be more flexible #107

Closed bullgare closed 2 years ago

bullgare commented 2 years ago

For now (as of github.com/grpc-ecosystem/grpc-gateway/v2@v2.10.2), PopulateQueryParameters is very strict about query params duplication. And it does not allow urls like /slug?param1=1&param1=1 as it has more than one value for the parameter that declared as a single value. So, we would need to handle it before passing the url to PopulateQueryParameters function.

The easiest way I see to do this is to update httpmw.DefaultChain, but I want to make it optional and configurable.

bullgare commented 2 years ago

As @utrack shared, it can be done a different way, there is no need to have it here. Let me just close it

utrack commented 2 years ago

Just for the history - DefaultChain is the last-mile middleware chain that is applied right in front of the handler. If you want to add any other middleware, you can always insert it into your router's mw chain. It will handle the request before passing the flow to the DefaultChain.