| @@ -58,7 +58,6 @@ func answerInitialAuth(w http.ResponseWriter, r *http.Request) { | |||
| //answerWechatPost distribute PostRequest according to xml body info | |||
| func answerWechatPost(w http.ResponseWriter, r *http.Request) { | |||
| in, valid := readWechatInput(r) | |||
| in.instantResponse = make(chan string) | |||
| reply := "" //nothing | |||
| w.Header().Set("Content-Type", "text/xml; charset=utf-8") | |||
| @@ -71,7 +70,7 @@ func answerWechatPost(w http.ResponseWriter, r *http.Request) { | |||
| //read instant response | |||
| reply = <-in.instantResponse | |||
| close(in.instantResponse) | |||
| in.destroy() | |||
| //uncomment the followin two lines to enable echo test | |||
| // state, _ := echoCommand(in.header.FromUserName, in) | |||
| // reply = state.response | |||
| @@ -93,6 +92,7 @@ func readWechatInput(r *http.Request) (result InWechatMsg, valid bool) { | |||
| } | |||
| valid = true | |||
| fmt.Printf("decrypt as: %s\n", d) | |||
| result.init() | |||
| result.header = ReadCommonHeader(d) | |||
| switch result.header.MsgType { | |||
| case "text": | |||