From efd8934ec17ec760eb74ff18ebeb29150d4c6874 Mon Sep 17 00:00:00 2001 From: "pzrr@qq.com" Date: Tue, 28 Aug 2018 13:41:08 +0800 Subject: [PATCH 1/3] #### Version 1.5.7.4 * Fixed Bug: Remove auto set NotFound http status when happened 404, if auto set, it will ignore any ContentType set * For issue #149 router middleware handle http 404,405. cann`t response content-type:application/json * Thanks for @lyw1995 * 2018-08-28 13:00 --- router.go | 1 - version.MD | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/router.go b/router.go index 0c26768..65396e3 100644 --- a/router.go +++ b/router.go @@ -263,7 +263,6 @@ func (r *router) ServeHTTP(ctx *HttpContext) { } // Handle 404 - ctx.Response().SetStatusCode(http.StatusNotFound) r.server.DotApp.NotFoundHandler(ctx) } diff --git a/version.MD b/version.MD index 366021b..4a1e216 100644 --- a/version.MD +++ b/version.MD @@ -1,5 +1,11 @@ ## dotweb版本记录: +#### Version 1.5.7.4 +* Fixed Bug: Remove auto set NotFound http status when happened 404, if auto set, it will ignore any ContentType set +* For issue #149 router middleware handle http 404,405. cann`t response content-type:application/json +* Thanks for @lyw1995 +* 2018-08-28 13:00 + #### Version 1.5.7.3 * New Feature: Add HttpServer.VirtualPath, used to set virtual path when deploy on no root path * Detail: From 98710f1400df1c88c540294520ad9b950e47e2f4 Mon Sep 17 00:00:00 2001 From: "pzrr@qq.com" Date: Tue, 28 Aug 2018 13:51:58 +0800 Subject: [PATCH 2/3] #### Version 1.5.7.4 * Fixed Bug: Remove auto set NotFound http status when happened 404, if auto set, it will ignore any ContentType set * For issue #149 router middleware handle http 404,405. cann`t response content-type:application/json, Thanks for @lyw1995 * Update: Add HostName in State page * 2018-08-28 13:00 --- core/state.go | 3 +++ version.MD | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/state.go b/core/state.go index caf20ba..16505f4 100644 --- a/core/state.go +++ b/core/state.go @@ -8,6 +8,7 @@ import ( "sync" "sync/atomic" "time" + "github.com/devfeel/dotweb/framework/sysx" ) var GlobalState *ServerStateInfo @@ -106,6 +107,8 @@ type ServerStateInfo struct { //ShowHtmlData show server state data html-string format func (state *ServerStateInfo) ShowHtmlData(version string) string { data := "
" + data += "HostInfo : " + sysx.GetHostName() + data += "
" data += "CurrentTime : " + time.Now().Format("2006-01-02 15:04:05") data += "
" data += "ServerVersion : " + version diff --git a/version.MD b/version.MD index 4a1e216..472e2e3 100644 --- a/version.MD +++ b/version.MD @@ -2,8 +2,8 @@ #### Version 1.5.7.4 * Fixed Bug: Remove auto set NotFound http status when happened 404, if auto set, it will ignore any ContentType set -* For issue #149 router middleware handle http 404,405. cann`t response content-type:application/json -* Thanks for @lyw1995 +* For issue #149 router middleware handle http 404,405. cann`t response content-type:application/json, Thanks for @lyw1995 +* Update: Add HostName in State page * 2018-08-28 13:00 #### Version 1.5.7.3 From 6405145d895bdc1c61c857080652a95452ab678d Mon Sep 17 00:00:00 2001 From: "pzrr@qq.com" Date: Tue, 28 Aug 2018 13:53:24 +0800 Subject: [PATCH 3/3] #### Version 1.5.7.4 * Fixed Bug: Remove auto set NotFound http status when happened 404, if auto set, it will ignore any ContentType set * For issue #149 router middleware handle http 404,405. cann`t response content-type:application/json, Thanks for @lyw1995 * Update: Add HostName in State page * 2018-08-28 13:00 --- framework/sysx/sysx.go | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 framework/sysx/sysx.go diff --git a/framework/sysx/sysx.go b/framework/sysx/sysx.go new file mode 100644 index 0000000..efeb177 --- /dev/null +++ b/framework/sysx/sysx.go @@ -0,0 +1,9 @@ +package sysx + +import "os" + +// GetHostName get host name +func GetHostName() string{ + host, _ := os.Hostname() + return host +}