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)
|
- 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)
|
- 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)
|
- 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
|
## Fix Sonar
|
||||||
|
|
||||||
|
|||||||
@ -290,7 +290,7 @@ type WebConfig struct {
|
|||||||
// @Default /static => static
|
// @Default /static => static
|
||||||
StaticDir map[string]string
|
StaticDir map[string]string
|
||||||
// StaticExtensionsToGzip
|
// 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" ]
|
// @Default [".css", ".js" ]
|
||||||
StaticExtensionsToGzip []string
|
StaticExtensionsToGzip []string
|
||||||
// StaticCacheFileSize
|
// StaticCacheFileSize
|
||||||
|
|||||||
@ -247,7 +247,7 @@ func (c *Controller) URLMapping() {}
|
|||||||
func (c *Controller) Bind(obj interface{}) error {
|
func (c *Controller) Bind(obj interface{}) error {
|
||||||
ct, exist := c.Ctx.Request.Header["Content-Type"]
|
ct, exist := c.Ctx.Request.Header["Content-Type"]
|
||||||
if !exist || len(ct) == 0 {
|
if !exist || len(ct) == 0 {
|
||||||
return c.BindJson(obj)
|
return c.BindJSON(obj)
|
||||||
}
|
}
|
||||||
i, l := 0, len(ct[0])
|
i, l := 0, len(ct[0])
|
||||||
for i < l && ct[0][i] != ';' {
|
for i < l && ct[0][i] != ';' {
|
||||||
@ -255,7 +255,7 @@ func (c *Controller) Bind(obj interface{}) error {
|
|||||||
}
|
}
|
||||||
switch ct[0][0:i] {
|
switch ct[0][0:i] {
|
||||||
case "application/json":
|
case "application/json":
|
||||||
return c.BindJson(obj)
|
return c.BindJSON(obj)
|
||||||
case "application/xml", "text/xml":
|
case "application/xml", "text/xml":
|
||||||
return c.BindXML(obj)
|
return c.BindXML(obj)
|
||||||
case "application/x-www-form-urlencoded":
|
case "application/x-www-form-urlencoded":
|
||||||
@ -277,7 +277,7 @@ func (c *Controller) BindForm(obj interface{}) error {
|
|||||||
return c.ParseForm(obj)
|
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)
|
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...)
|
return URLFor(endpoint, values...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) JsonResp(data interface{}) error {
|
func (c *Controller) JSONResp(data interface{}) error {
|
||||||
c.Data["json"] = data
|
c.Data["json"] = data
|
||||||
return c.ServeJSON()
|
return c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) XmlResp(data interface{}) error {
|
func (c *Controller) XMLResp(data interface{}) error {
|
||||||
c.Data["xml"] = data
|
c.Data["xml"] = data
|
||||||
return c.ServeXML()
|
return c.ServeXML()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -619,7 +619,7 @@ func (app *HttpServer) CtrlAny(rootpath string, f interface{}) *HttpServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get see HttpServer.Get
|
// Get see HttpServer.Get
|
||||||
func Get(rootpath string, f FilterFunc) *HttpServer {
|
func Get(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Get(rootpath, f)
|
return BeeApp.Get(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,13 +628,13 @@ func Get(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Get("/", func(ctx *context.Context){
|
// beego.Get("/", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Get(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post see HttpServer.Post
|
// Post see HttpServer.Post
|
||||||
func Post(rootpath string, f FilterFunc) *HttpServer {
|
func Post(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Post(rootpath, f)
|
return BeeApp.Post(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,13 +643,13 @@ func Post(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Post("/api", func(ctx *context.Context){
|
// beego.Post("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Post(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete see HttpServer.Delete
|
// Delete see HttpServer.Delete
|
||||||
func Delete(rootpath string, f FilterFunc) *HttpServer {
|
func Delete(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Delete(rootpath, f)
|
return BeeApp.Delete(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,13 +658,13 @@ func Delete(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Delete("/api", func(ctx *context.Context){
|
// beego.Delete("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Delete(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put see HttpServer.Put
|
// Put see HttpServer.Put
|
||||||
func Put(rootpath string, f FilterFunc) *HttpServer {
|
func Put(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Put(rootpath, f)
|
return BeeApp.Put(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,13 +673,13 @@ func Put(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Put("/api", func(ctx *context.Context){
|
// beego.Put("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Put(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Head see HttpServer.Head
|
// Head see HttpServer.Head
|
||||||
func Head(rootpath string, f FilterFunc) *HttpServer {
|
func Head(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Head(rootpath, f)
|
return BeeApp.Head(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,13 +688,13 @@ func Head(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Head("/api", func(ctx *context.Context){
|
// beego.Head("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Head(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Options see HttpServer.Options
|
// Options see HttpServer.Options
|
||||||
func Options(rootpath string, f FilterFunc) *HttpServer {
|
func Options(rootpath string, f HandleFunc) *HttpServer {
|
||||||
BeeApp.Handlers.Options(rootpath, f)
|
BeeApp.Handlers.Options(rootpath, f)
|
||||||
return BeeApp
|
return BeeApp
|
||||||
}
|
}
|
||||||
@ -704,13 +704,13 @@ func Options(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Options("/api", func(ctx *context.Context){
|
// beego.Options("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Options(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patch see HttpServer.Patch
|
// Patch see HttpServer.Patch
|
||||||
func Patch(rootpath string, f FilterFunc) *HttpServer {
|
func Patch(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Patch(rootpath, f)
|
return BeeApp.Patch(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,13 +719,13 @@ func Patch(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Patch("/api", func(ctx *context.Context){
|
// beego.Patch("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Patch(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any see HttpServer.Any
|
// Any see HttpServer.Any
|
||||||
func Any(rootpath string, f FilterFunc) *HttpServer {
|
func Any(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Any(rootpath, f)
|
return BeeApp.Any(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ func Any(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Any("/api", func(ctx *context.Context){
|
// beego.Any("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// 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)
|
app.Handlers.Any(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user