fix issue in content-type response for ghttp.Server

This commit is contained in:
John 2019-10-14 13:46:16 +08:00
parent 2dc2610621
commit 2804183325
2 changed files with 4 additions and 4 deletions

View File

@ -137,6 +137,10 @@ func (r *Response) WriteStatus(status int, content ...interface{}) {
} else {
r.Write(http.StatusText(status))
}
if r.Header().Get("Content-Type") == "" {
r.Header().Set("Content-Type", "text/plain; charset=utf-8")
//r.Header().Set("X-Content-Type-Options", "nosniff")
}
}
// ServeFile serves the file to the response.

View File

@ -155,10 +155,6 @@ func (s *Server) handleRequest(w http.ResponseWriter, r *http.Request) {
})
}
}
if request.Response.Header().Get("Content-Type") == "" {
request.Response.Header().Set("Content-Type", "text/plain; charset=utf-8")
//r.Header().Set("X-Content-Type-Options", "nosniff")
}
// 设置Session Id到Cookie中
if request.Session.IsDirty() && request.Session.Id() != request.GetSessionId() {