This commit is contained in:
hoteas 2017-10-13 09:52:34 +00:00
parent b0d2e17b06
commit 0e935832d3

View File

@ -4,6 +4,7 @@ import (
"bytes"
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
@ -40,7 +41,15 @@ func (this *Application) Run(router Router) {
this.CacheIns = CacheIns(&CacheMemory{Map: Map{}, Time: this.Config.GetInt64("cacheShortTime")})
}
//http.HandleFunc("/", this.handler)
//异常处理
defer func() {
if err := recover(); err != nil {
//e.SetError(errors.New(ObjToStr(err)), LOG_FMT)
fmt.Println(err)
this.Run(router)
}
}()
run(this)
}
@ -264,7 +273,6 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
//设置header
mimeStr := Substr(path, strings.LastIndex(path, "."), len(path))
//类型判断并设置Content-Type
if value, ok := mimeMaps[mimeStr]; ok {
header.Set("Content-Type", value)