mirror of
https://gitee.com/johng/gf.git
synced 2024-12-01 03:38:35 +08:00
fix issue in content-type response for ghttp.Server
This commit is contained in:
parent
2dc2610621
commit
2804183325
@ -137,6 +137,10 @@ func (r *Response) WriteStatus(status int, content ...interface{}) {
|
|||||||
} else {
|
} else {
|
||||||
r.Write(http.StatusText(status))
|
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.
|
// ServeFile serves the file to the response.
|
||||||
|
@ -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中
|
// 设置Session Id到Cookie中
|
||||||
if request.Session.IsDirty() && request.Session.Id() != request.GetSessionId() {
|
if request.Session.IsDirty() && request.Session.Id() != request.GetSessionId() {
|
||||||
|
Loading…
Reference in New Issue
Block a user