Always set content-type & nosniff

Kubernetes-commit: ef6cba0b3635fc99eb658ecd4a29cf63bb234cb6
This commit is contained in:
Tim Allclair 2019-01-03 11:13:28 -08:00 committed by Kubernetes Publisher
parent 00a7b50aba
commit d77c4fc8ba
1 changed files with 1 additions and 0 deletions

View File

@ -121,6 +121,7 @@ func StringFlagPutHandler(setter StringFlagSetterFunc) http.HandlerFunc {
// writePlainText renders a simple string response.
func writePlainText(statusCode int, text string, w http.ResponseWriter) {
w.Header().Set("Content-Type", "text/plain")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.WriteHeader(statusCode)
fmt.Fprintln(w, text)
}