git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/httpx/error.go (about) 1 package httpx 2 3 import ( 4 "fmt" 5 "net/http" 6 ) 7 8 func ServerInternalErrorPlaintext(w http.ResponseWriter, message *string) { 9 var data string 10 11 if message == nil { 12 data = "Internal Error" 13 } else { 14 data = *message 15 } 16 17 w.Header().Set("Content-Type", "text/plain; charset=utf-8") 18 w.Header().Set("X-Content-Type-Options", "nosniff") 19 w.WriteHeader(http.StatusInternalServerError) 20 fmt.Fprintln(w, data) 21 }