Problem
As stated in #241 gin compatibility layer currently does not support per route middlewares. option.Middleware applies no middlewares to gin engine.
Points of interest
Solution
We don't introduce any API breaking changes, still store middlewares everywhere as func (http.Handler) http.Handler and convert them to gin ones when registering routes. Major problem is wrapping. Convert http middleware to gin is not a problem. But we also want to pass gin middlewares and it's a problem since we store all middlewares as http ones. So we have to convert one gin middleware twice. One when we pass it to storage using option, second when we apply it to gin. So idk if this way is reasonable cause converting gin middleware to http one is a bit runtime-consuming
Problem
As stated in #241 gin compatibility layer currently does not support per route middlewares.
option.Middlewareapplies no middlewares to gin engine.Points of interest
func (http.Handler) http.Handler) to gin engine using wrapping (easy task)func (c gin.Context)) (bit harder, description below)Solution
We don't introduce any API breaking changes, still store middlewares everywhere as
func (http.Handler) http.Handlerand convert them to gin ones when registering routes. Major problem is wrapping. Convert http middleware to gin is not a problem. But we also want to pass gin middlewares and it's a problem since we store all middlewares as http ones. So we have to convert one gin middleware twice. One when we pass it to storage using option, second when we apply it to gin. So idk if this way is reasonable cause converting gin middleware to http one is a bit runtime-consuming