Backport: Disable content sniffing on PlainTextBytes
(#18365)
- Backport of #18359
This commit is contained in:
parent
fd9ff7cd6f
commit
d644289fcb
1 changed files with 1 additions and 0 deletions
|
@ -291,6 +291,7 @@ func (ctx *Context) PlainTextBytes(status int, bs []byte) {
|
||||||
}
|
}
|
||||||
ctx.Resp.WriteHeader(status)
|
ctx.Resp.WriteHeader(status)
|
||||||
ctx.Resp.Header().Set("Content-Type", "text/plain;charset=utf-8")
|
ctx.Resp.Header().Set("Content-Type", "text/plain;charset=utf-8")
|
||||||
|
ctx.Resp.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
if _, err := ctx.Resp.Write(bs); err != nil {
|
if _, err := ctx.Resp.Write(bs); err != nil {
|
||||||
log.Error("Write bytes failed: %v", err)
|
log.Error("Write bytes failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue