fix: HttpMiddlewareFunc needs its own case

This commit is contained in:
Derrick Hammer 2024-02-17 05:38:50 -05:00
parent 9949dae5e8
commit 3ded11d705
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 1 deletions

View File

@ -51,9 +51,12 @@ func ApplyMiddlewares(handler jape.Handler, middlewares ...interface{}) jape.Han
case JapeMiddlewareFunc:
mid := middlewares[i].(JapeMiddlewareFunc)
handler = mid(handler)
case func(http.Handler) http.Handler, HttpMiddlewareFunc:
case func(http.Handler) http.Handler:
mid := middlewares[i].(func(http.Handler) http.Handler)
handler = AdaptMiddleware(mid)(handler)
case HttpMiddlewareFunc:
mid := middlewares[i].(HttpMiddlewareFunc)
handler = AdaptMiddleware(mid)(handler)
default:
panic("Invalid middleware type")