diff --git a/README.md b/README.md index 9e92ab6..694db11 100644 --- a/README.md +++ b/README.md @@ -271,9 +271,9 @@ type NotFoundHandle func(http.ResponseWriter, *http.Request) ## Dependency websocket - golang.org/x/net/websocket - 内置vendor
-redis - github.com/garyburd/redigo - 需自行go get +redis - github.com/garyburd/redigo - go get自动下载
-yaml - gopkg.in/yaml.v2 - 需自行go get +yaml - gopkg.in/yaml.v2 - go get自动下载 ## 相关项目 #### LongWeb diff --git a/consts.go b/consts.go index a582bc2..22fc2a6 100644 --- a/consts.go +++ b/consts.go @@ -14,7 +14,7 @@ const ( //Http define const ( - CharsetUTF8 = "text/plain; charset=utf-8" + CharsetUTF8 = "charset=utf-8" DefaultServerName = "dotweb" ) diff --git a/example/main.go b/example/main.go index 19a1424..0862b40 100644 --- a/example/main.go +++ b/example/main.go @@ -58,6 +58,11 @@ func main() { ctx.Response().Write(http.StatusNotFound, []byte("is't app's not found!")) }) + app.SetExceptionHandle(func(ctx dotweb.Context, err error) { + ctx.Response().SetContentType(dotweb.MIMEApplicationJSONCharsetUTF8) + ctx.WriteJsonC(http.StatusInternalServerError, err.Error()) + }) + //设置HttpModule //InitModule(app) diff --git a/version.MD b/version.MD index 8bed871..ae5e981 100644 --- a/version.MD +++ b/version.MD @@ -1,5 +1,10 @@ ## dotweb版本记录: +#### Version 1.4.9.2 +* 修复BUG for #112 +* 调整CharsetUTF8值为"charset=utf-8" +* 2018-03-28 09:00 + #### Version 1.4.9.1 * 内置Vendor目录仅保留 golang.org/x/net包,移除redis与yaml包 * 完善RedisClient接口能力