Compare commits

..

No commits in common. "master" and "v1.0.10" have entirely different histories.

3 changed files with 1 additions and 14 deletions

6
api.go
View File

@ -54,12 +54,6 @@ func (e *Engine) POST(uri string, handler Handler) {
e.Engine.POST(uri, h)
}
func (e *Engine) GET(uri string, handler Handler) {
h := handlerWrapper(handler)
log.Infof("api handler [%v] registor success", handler)
e.Engine.GET(uri, h)
}
// handlerWrapper
func handlerWrapper(handler Handler) gin.HandlerFunc {
handlerFunc := handler.HandlerFunc()

View File

@ -120,14 +120,7 @@ func (c *Context) SetCookie(cookie *http.Cookie) {
http.SetCookie(c.Writer, cookie)
}
func (c *Context) AlreadyHaveResult() (done bool, entry string) {
return c.resultentry != "", c.resultentry
}
func (c *Context) RESULT(output interface{}) error {
if c.resultentry == "" {
c.resultentry = "RESULT"
}
var t = reflect.TypeOf(output)
defer func(o *interface{}) {
b, err := json.Marshal(o)
@ -156,6 +149,7 @@ func (c *Context) RESULT(output interface{}) error {
cost := time.Now().Sub(c.starttime).Milliseconds()
noticeStr := fmt.Sprintf("cost: %dms, output: '%s'", cost, string(b))
log.NoticefWithDepth(calldepth, noticeStr)
}(&output)
if _, ok := t.FieldByName("ErrCode"); !ok {

View File

@ -47,7 +47,6 @@ type Handler interface {
type HandlerFunc func(*Context) error
type IRoutes interface {
GET(uri string, handler Handler)
POST(uri string, handler Handler)
}