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 }