Implemented request validation in a filter
This commit is contained in:
+7
-7
@@ -1,16 +1,10 @@
|
||||
// @APIVersion 1.0.0
|
||||
// @Title beego Test API
|
||||
// @Description beego has a very cool tools to autogenerate documents for your API
|
||||
// @Contact astaxie@gmail.com
|
||||
// @TermsOfServiceUrl http://beego.me/
|
||||
// @License Apache 2.0
|
||||
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
package routers
|
||||
|
||||
import (
|
||||
"github.com/deluan/gosonic/controllers"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/context"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -19,4 +13,10 @@ func init() {
|
||||
&controllers.GetLicenseController{},
|
||||
&controllers.GetMusicFoldersController{},
|
||||
)
|
||||
|
||||
var ValidateRequest = func(ctx *context.Context) {
|
||||
controllers.Validate(&beego.Controller{Ctx: ctx})
|
||||
}
|
||||
|
||||
beego.InsertFilter("/rest/*", beego.BeforeRouter, ValidateRequest)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user