Переглянути джерело

content type header added

master
Patrick Peng Sun 8 роки тому
джерело
коміт
bc4598d8b2
1 змінених файлів з 2 додано та 0 видалено
  1. +2
    -0
      server.go

+ 2
- 0
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
}

Завантаження…
Відмінити
Зберегти