feat(weixin_ilink): 扫码协议与腾讯官方对齐——POST local_token_list + iLink-App-Id/ClientVersion 头 + need_verifycode/redirect 状态机
This commit is contained in:
1 parent
bef398d47a
commit
f5950e4bde
9 files changed
+508
-99
No files matched your search
@@ -3,6 +3,7 @@ package weixin_ilink
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -48,6 +49,16 @@ func TestStartLogin_WaitThenConfirm(t *testing.T) {
|
||||
if got := ad.Config()["bot_token"]; got != "tok-x" {
|
||||
t.Fatalf("bot_token = %v, want tok-x", got)
|
||||
}
|
||||
// The QR mint must be a POST carrying the iLink identify headers per the
|
||||
// official protocol.
|
||||
for _, q := range rec.find(func(q recordedReq) bool { return q.path == "/ilink/bot/get_bot_qrcode" }) {
|
||||
if q.method != http.MethodPost {
|
||||
t.Fatalf("get_bot_qrcode method = %q, want POST", q.method)
|
||||
}
|
||||
if q.appID != "bot" || q.appClientVer != "132104" {
|
||||
t.Fatalf("get_bot_qrcode iLink headers = (%q, %q), want (bot, 132104)", q.appID, q.appClientVer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestStartLogin_IdempotentWhileWaiting verifies a second StartLogin while a login
|
||||
|
||||
Reference in new issue
Block a user