From f941ee46d469a3f0a6302b188f566029fdec4e70 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 9 Jun 2023 04:16:58 -0400 Subject: [PATCH] fix: we can't use AddHandler inside BeginRequest --- controller/files.go | 4 +++- middleware/jwt.go | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controller/files.go b/controller/files.go index 525a181..631d5d5 100644 --- a/controller/files.go +++ b/controller/files.go @@ -17,7 +17,9 @@ type FilesController struct { } func (f *FilesController) BeginRequest(ctx iris.Context) { - ctx.AddHandler(middleware.VerifyJwt) + middleware.VerifyJwt(ctx) +} +func (f *FilesController) EndRequest(ctx iris.Context) { } func (f *FilesController) PostUpload() { diff --git a/middleware/jwt.go b/middleware/jwt.go index 8594920..d5028b5 100644 --- a/middleware/jwt.go +++ b/middleware/jwt.go @@ -17,6 +17,4 @@ func VerifyJwt(ctx iris.Context) { ctx.StopWithError(iris.StatusUnauthorized, auth.ErrInvalidToken) return } - - ctx.Next() }