This commit is contained in:
John Guo 2021-05-02 08:10:35 +08:00
parent 563509c4a6
commit 5856f74d83
2 changed files with 5 additions and 4 deletions

View File

@ -263,7 +263,7 @@ func (s *Server) GetRouterArray() []RouterItem {
if len(item.handler.middleware) > 0 {
for _, v := range item.handler.middleware {
if item.Middleware != "" {
item.Middleware += "\n"
item.Middleware += ","
}
item.Middleware += gdebug.FuncName(v)
}

View File

@ -80,9 +80,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Close the request and response body
// to release the file descriptor in time.
request.Request.Body.Close()
_ = request.Request.Body.Close()
if request.Request.Response != nil {
request.Request.Response.Body.Close()
_ = request.Request.Response.Body.Close()
}
}()
@ -168,7 +168,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
// Automatically set the session id to cookie
// if it creates a new session id in this request.
// if it creates a new session id in this request
// and SessionCookieOutput is enabled.
if s.config.SessionCookieOutput &&
request.Session.IsDirty() &&
request.Session.Id() != request.GetSessionId() {