Skip to content
This repository has been archived by the owner on Jun 5, 2021. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Sep 3, 2015
1 parent 2cf3ec1 commit 87a8397
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ xweb是一个强大的Go语言web框架。
QQ群:369240307

## 更新日志
* **v0.4.0** : AddTmplVar改为Assign;AddTmplVars改为MultiAssign;日志中增加IP、页面大小(单位:字节)以及耗时记录;修复bug
* **v0.3.0** : 增加对称加密、XSRF通用接口,更换hook引擎为更加优雅的events引擎
* **v0.2.1** : 自动Binding新增对jquery对象,map和array的支持。
* **v0.2** : 新增 validation 子包,从 [https://github.com/astaxie/beego/tree/master/validation](http://https://github.com/astaxie/beego/tree/master/validation) 拷贝过来。
Expand Down
27 changes: 16 additions & 11 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,36 +682,41 @@ func (a *App) run(req *http.Request, w http.ResponseWriter, route Route, args []
}

sval := ret[0]

intf := sval.Interface()
kind := sval.Kind()
var content []byte
if sval.Interface() == nil || sval.Kind() == reflect.Bool {
if intf == nil || kind == reflect.Bool {
isBreak = true
responseSize = c.ResponseSize
return
} else if sval.Kind() == reflect.String {
} else if kind == reflect.String {
content = []byte(sval.String())
} else if sval.Kind() == reflect.Slice && sval.Type().Elem().Kind() == reflect.Uint8 {
content = sval.Interface().([]byte)
} else if obj, ok := sval.Interface().(JSON); ok {
} else if kind == reflect.Slice && sval.Type().Elem().Kind() == reflect.Uint8 {
content = intf.([]byte)
} else if _, ok := intf.(bool); ok {
responseSize = c.ResponseSize
isBreak = true
return
} else if obj, ok := intf.(JSON); ok {
c.ServeJson(obj.Data)
responseSize = c.ResponseSize
isBreak = true
return
} else if obj, ok := sval.Interface().(JSONP); ok {
} else if obj, ok := intf.(JSONP); ok {
c.ServeJsonp(obj.Data, obj.Callback)
responseSize = c.ResponseSize
isBreak = true
return
} else if obj, ok := sval.Interface().(XML); ok {
} else if obj, ok := intf.(XML); ok {
c.ServeXml(obj.Data)
responseSize = c.ResponseSize
isBreak = true
return
} else if file, ok := sval.Interface().(FILE); ok {
} else if file, ok := intf.(FILE); ok {
c.ServeFile(file.Data)
isBreak = true
return
} else if err, ok := sval.Interface().(error); ok {
} else if err, ok := intf.(error); ok {
if err != nil {
a.Error("Error:", err)
a.error(w, 500, "Server Error")
Expand All @@ -722,7 +727,7 @@ func (a *App) run(req *http.Request, w http.ResponseWriter, route Route, args []
isBreak = true
return
} else {
a.Warnf("unknown returned result type %v, ignored %v", sval.Kind(), sval.Interface())
a.Warnf("unknown returned result type %v, ignored %v", kind, intf)
isBreak = true
return
}
Expand Down
2 changes: 1 addition & 1 deletion xweb.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

const (
Version = "0.3.0"
Version = "0.4.0"
)

const (
Expand Down

0 comments on commit 87a8397

Please sign in to comment.