Add charset to UTF-8 for content type headers

master
Buddy Sandidge 8 years ago
parent 27f0424765
commit 3edb2ed2b1

@ -98,7 +98,7 @@ func (s *Server) sendResponse(resp http.ResponseWriter, ip *IP, responseType res
s.logger.Printf("Request from %s %s\n", ip.version, ip) s.logger.Printf("Request from %s %s\n", ip.version, ip)
var body []byte var body []byte
var contentType = "text/plain" var contentType = "text/plain; charset=utf-8"
var err error var err error
switch responseType { switch responseType {
@ -108,7 +108,7 @@ func (s *Server) sendResponse(resp http.ResponseWriter, ip *IP, responseType res
if marshalErr != nil { if marshalErr != nil {
err = errors.Wrap(marshalErr, "could not marshal json") err = errors.Wrap(marshalErr, "could not marshal json")
} }
contentType = "application/json" contentType = "application/json; charset=utf-8"
body = jsonBody body = jsonBody
case htmlResponse: case htmlResponse:
@ -117,7 +117,7 @@ func (s *Server) sendResponse(resp http.ResponseWriter, ip *IP, responseType res
if exeErr != nil { if exeErr != nil {
err = errors.Wrap(exeErr, "could not get html") err = errors.Wrap(exeErr, "could not get html")
} }
contentType = "text/html" contentType = "text/html; charset=utf-8"
body = buffer.Bytes() body = buffer.Bytes()
default: default:

Loading…
Cancel
Save