接入RESTfull风格接口
This commit is contained in:
+1
-15
@@ -289,14 +289,11 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
cookie, err := req.Cookie(that.Config.GetString("sessionName"))
|
||||
sessionId := Md5(strconv.Itoa(Rand(10)))
|
||||
token := req.FormValue("token")
|
||||
//isFirst:=false
|
||||
|
||||
if err != nil || (len(token) == 32 && cookie.Value != token) {
|
||||
if len(token) == 32 {
|
||||
sessionId = token
|
||||
}
|
||||
//else{
|
||||
// isFirst=true;
|
||||
//}
|
||||
http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"})
|
||||
} else {
|
||||
sessionId = cookie.Value
|
||||
@@ -339,17 +336,6 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
//接口服务
|
||||
//if len(s) == 3 {
|
||||
// //如果满足规则则路由到对应控制器去
|
||||
// if that.Router[s[0]] != nil && that.Router[s[0]][s[1]] != nil && that.Router[s[0]][s[1]][s[2]] != nil {
|
||||
// //控制层
|
||||
// that.Router[s[0]][s[1]][s[2]](&context)
|
||||
// //header.Set("Content-Type", "text/html; charset=utf-8")
|
||||
// context.View()
|
||||
// return
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//验证接口严格模式
|
||||
modeRouterStrict := that.Config.GetBool("modeRouterStrict")
|
||||
tempHandlerStr := context.HandlerStr
|
||||
|
||||
Reference in New Issue
Block a user