From bc4598d8b233391864d35b979900991fbed8ae38 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Sun, 30 Apr 2017 20:23:18 +1000 Subject: [PATCH] content type header added --- server.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server.go b/server.go index 9379213..2fdb645 100644 --- a/server.go +++ b/server.go @@ -18,6 +18,7 @@ func apiV1Main(w http.ResponseWriter, r *http.Request) { logRequestDebug(httputil.DumpRequest(r, true)) if checkSignature(r) == false { log.Println("signature of URL incorrect") + w.Header().Set("Content-Type", "text/xml; charset=utf-8") w.WriteHeader(http.StatusUnauthorized) fmt.Fprintf(w, "") //empty string return @@ -60,6 +61,7 @@ func answerWechatPost(w http.ResponseWriter, r *http.Request) { fmt.Printf("decrypt as: %s", d) h := ReadCommonHeader(d) reply, _ := BuildTextMsg(h.MsgType, h.FromUserName) + w.Header().Set("Content-Type", "text/xml; charset=utf-8") fmt.Fprint(w, reply) return }