Add change log
This commit is contained in:
parent
32d7633a04
commit
9ce8aa734a
@ -54,6 +54,7 @@
|
||||
- Init exceptMethod by using reflection. [4583](https://github.com/beego/beego/pull/4583)
|
||||
- Deprecated BeeMap and replace all usage with `sync.map` [4616](https://github.com/beego/beego/pull/4616)
|
||||
- TaskManager support graceful shutdown [4635](https://github.com/beego/beego/pull/4635)
|
||||
- Add comments to `web.Config`, rename `RouterXXX` to `CtrlXXX`, define `HandleFunc` [4714](https://github.com/beego/beego/pull/4714)
|
||||
|
||||
## Fix Sonar
|
||||
|
||||
|
||||
@ -290,7 +290,7 @@ type WebConfig struct {
|
||||
// @Default /static => static
|
||||
StaticDir map[string]string
|
||||
// StaticExtensionsToGzip
|
||||
// @Description The static resources with those extension wille be compressed if EnableGzip is true
|
||||
// @Description The static resources with those extension will be compressed if EnableGzip is true
|
||||
// @Default [".css", ".js" ]
|
||||
StaticExtensionsToGzip []string
|
||||
// StaticCacheFileSize
|
||||
|
||||
@ -247,7 +247,7 @@ func (c *Controller) URLMapping() {}
|
||||
func (c *Controller) Bind(obj interface{}) error {
|
||||
ct, exist := c.Ctx.Request.Header["Content-Type"]
|
||||
if !exist || len(ct) == 0 {
|
||||
return c.BindJson(obj)
|
||||
return c.BindJSON(obj)
|
||||
}
|
||||
i, l := 0, len(ct[0])
|
||||
for i < l && ct[0][i] != ';' {
|
||||
@ -255,7 +255,7 @@ func (c *Controller) Bind(obj interface{}) error {
|
||||
}
|
||||
switch ct[0][0:i] {
|
||||
case "application/json":
|
||||
return c.BindJson(obj)
|
||||
return c.BindJSON(obj)
|
||||
case "application/xml", "text/xml":
|
||||
return c.BindXML(obj)
|
||||
case "application/x-www-form-urlencoded":
|
||||
@ -277,7 +277,7 @@ func (c *Controller) BindForm(obj interface{}) error {
|
||||
return c.ParseForm(obj)
|
||||
}
|
||||
|
||||
func (c *Controller) BindJson(obj interface{}) error {
|
||||
func (c *Controller) BindJSON(obj interface{}) error {
|
||||
return json.Unmarshal(c.Ctx.Input.RequestBody, obj)
|
||||
}
|
||||
|
||||
@ -439,12 +439,12 @@ func (c *Controller) URLFor(endpoint string, values ...interface{}) string {
|
||||
return URLFor(endpoint, values...)
|
||||
}
|
||||
|
||||
func (c *Controller) JsonResp(data interface{}) error {
|
||||
c.Data["json"]=data
|
||||
func (c *Controller) JSONResp(data interface{}) error {
|
||||
c.Data["json"] = data
|
||||
return c.ServeJSON()
|
||||
}
|
||||
|
||||
func (c *Controller) XmlResp(data interface{}) error {
|
||||
func (c *Controller) XMLResp(data interface{}) error {
|
||||
c.Data["xml"] = data
|
||||
return c.ServeXML()
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ type FilterChain func(next FilterFunc) FilterFunc
|
||||
// FilterFunc defines a filter function which is invoked before the controller handler is executed.
|
||||
// It's a alias of HandleFunc
|
||||
// In fact, the HandleFunc is the last Filter. This is the truth
|
||||
type FilterFunc=HandleFunc
|
||||
type FilterFunc = HandleFunc
|
||||
|
||||
// FilterRouter defines a filter operation which is invoked before the controller handler is executed.
|
||||
// It can match the URL against a pattern, and execute a filter function
|
||||
|
||||
@ -619,7 +619,7 @@ func (app *HttpServer) CtrlAny(rootpath string, f interface{}) *HttpServer {
|
||||
}
|
||||
|
||||
// Get see HttpServer.Get
|
||||
func Get(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Get(rootpath string, f HandleFunc) *HttpServer {
|
||||
return BeeApp.Get(rootpath, f)
|
||||
}
|
||||
|
||||
@ -628,13 +628,13 @@ func Get(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Get("/", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Get(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Get(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Get(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
// Post see HttpServer.Post
|
||||
func Post(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Post(rootpath string, f HandleFunc) *HttpServer {
|
||||
return BeeApp.Post(rootpath, f)
|
||||
}
|
||||
|
||||
@ -643,13 +643,13 @@ func Post(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Post("/api", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Post(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Post(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Post(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
// Delete see HttpServer.Delete
|
||||
func Delete(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Delete(rootpath string, f HandleFunc) *HttpServer {
|
||||
return BeeApp.Delete(rootpath, f)
|
||||
}
|
||||
|
||||
@ -658,13 +658,13 @@ func Delete(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Delete("/api", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Delete(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Delete(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Delete(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
// Put see HttpServer.Put
|
||||
func Put(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Put(rootpath string, f HandleFunc) *HttpServer {
|
||||
return BeeApp.Put(rootpath, f)
|
||||
}
|
||||
|
||||
@ -673,13 +673,13 @@ func Put(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Put("/api", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Put(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Put(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Put(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
// Head see HttpServer.Head
|
||||
func Head(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Head(rootpath string, f HandleFunc) *HttpServer {
|
||||
return BeeApp.Head(rootpath, f)
|
||||
}
|
||||
|
||||
@ -688,13 +688,13 @@ func Head(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Head("/api", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Head(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Head(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Head(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
// Options see HttpServer.Options
|
||||
func Options(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Options(rootpath string, f HandleFunc) *HttpServer {
|
||||
BeeApp.Handlers.Options(rootpath, f)
|
||||
return BeeApp
|
||||
}
|
||||
@ -704,13 +704,13 @@ func Options(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Options("/api", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Options(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Options(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Options(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
// Patch see HttpServer.Patch
|
||||
func Patch(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Patch(rootpath string, f HandleFunc) *HttpServer {
|
||||
return BeeApp.Patch(rootpath, f)
|
||||
}
|
||||
|
||||
@ -719,13 +719,13 @@ func Patch(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Patch("/api", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Patch(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Patch(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Patch(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
// Any see HttpServer.Any
|
||||
func Any(rootpath string, f FilterFunc) *HttpServer {
|
||||
func Any(rootpath string, f HandleFunc) *HttpServer {
|
||||
return BeeApp.Any(rootpath, f)
|
||||
}
|
||||
|
||||
@ -734,7 +734,7 @@ func Any(rootpath string, f FilterFunc) *HttpServer {
|
||||
// beego.Any("/api", func(ctx *context.Context){
|
||||
// ctx.Output.Body("hello world")
|
||||
// })
|
||||
func (app *HttpServer) Any(rootpath string, f FilterFunc) *HttpServer {
|
||||
func (app *HttpServer) Any(rootpath string, f HandleFunc) *HttpServer {
|
||||
app.Handlers.Any(rootpath, f)
|
||||
return app
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user