diff --git a/customMenu.go b/customMenu.go index 0f75fac..329e568 100644 --- a/customMenu.go +++ b/customMenu.go @@ -84,3 +84,7 @@ func jsonPostRequest(url string, jsonBody []byte) error { return nil } + +func GetMenu() { + +} diff --git a/customMenu_test.go b/customMenu_test.go new file mode 100644 index 0000000..82d58a8 --- /dev/null +++ b/customMenu_test.go @@ -0,0 +1,9 @@ +package main + +import "testing" + +//This test retrieve current menu +func TestGetMenu(t *testing.T) { + SetupConfig() + +} diff --git a/inMsg_test.go b/inMsg_test.go index 1a76117..5d89013 100644 --- a/inMsg_test.go +++ b/inMsg_test.go @@ -176,3 +176,35 @@ func TestReadEncryptMsg(t *testing.T) { AssertEqual(t, m.ToUserName, "gh_f09231355c68", "ToUserName failed") AssertEqual(t, m.Encrypt, "Dv3epMMhmmGU1o6lg71IfbpRrOYX1S8oZX3nwW0uBAHHMKx62T4KniS4efuf8fNHWf6gsF/YGaDraF6HhGOdKp8vbzluiIEsCnIveKN1pO+IUDOBBxzPAzQSFSYJ3OwVXWmBdBcC1S5guQrOxLysH+6UIWSor9cEef+94UAKTNw/MLB0zPfqK5TVoN1A0yobmP9OU8wtFJP0L1aKySPFGGbqBMfJkStRTrYLjIQfZ7pAIisB/g3c87w26r7LUz9hVh4ey3/T6cjQ8vKvgNKL3j8y4IwUdmnmTPrrdOsyA1pz69977xKHFtIptZYHKGD9dTW6PyPcKKTP6iOod6Agb8TI+is80auqHkjvUyvT/xPG8fxak/wI9BKzKndAnwxlcDG/8WElkHVl0TwxpsCb48ZxLEf4GFKaYaliC9xBVweKLNnqdbBmzwfe7GBNWC61h7KQYqwtZqMkZs3BBsStcQ==", "ToUserName failed") } + +func TestAcceptLocationInfo(t *testing.T) { + + // POST /api?signature=1a9991fc0d1916495e26e07dca7d2c305c529b0d×tamp=1493303819&nonce=1367712073&openid=oUN420bxqFqlx0ZQHciUOesZO3PE&encrypt_type=aes&msg_signature=46331890d4c95a017a014a009ccc7f37228665db HTTP/1.1 + // Host: wechat.hitxy.org.au + // Accept: */* + // Cache-Control: no-cache + // Connection: Keep-Alive + // Content-Length: 618 + // Content-Type: text/xml + // Pragma: no-cache + // User-Agent: Mozilla/4.0 + // X-Forwarded-For: 103.7.30.105 + // X-Forwarded-Host: wechat.hitxy.org.au + // X-Forwarded-Server: wechat.hitxy.org.au + + // + // + // + // + + // Decript as: + // + // + // 1493304047 + // + // + // -33.764935 + // 150.960327 + // 110.000000 + // +} diff --git a/server.go b/server.go index e2511b9..3ee94e2 100644 --- a/server.go +++ b/server.go @@ -56,7 +56,7 @@ func answerWechatPost(w http.ResponseWriter, r *http.Request) { s := ReadEncryptedMsg(string(body)) //fmt.Printf("to decrypt %s", s.Encrypt) d := Decode(s.Encrypt) - //fmt.Printf("decrypt as: %s", d) + fmt.Printf("decrypt as: %s", d) h := ReadCommonHeader(d) reply, _ := BuildTextMsg(h.MsgType, h.FromUserName) fmt.Fprint(w, reply)