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
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -78,6 +79,29 @@ func TestStartLogin_ScanStatusTransition(t *testing.T) {
|
||||
t.Fatalf("status poll AuthorizationType = %q, want ilink_bot_token", q.authType)
|
||||
}
|
||||
}
|
||||
// Confirm the QR mint follows the official protocol: POST, the iLink
|
||||
// App identify headers, and a local_token_list body (empty on a fresh bind).
|
||||
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" {
|
||||
t.Fatalf("get_bot_qrcode iLink-App-Id = %q, want bot", q.appID)
|
||||
}
|
||||
if q.appClientVer != "132104" {
|
||||
t.Fatalf("get_bot_qrcode iLink-App-ClientVersion = %q, want 132104", q.appClientVer)
|
||||
}
|
||||
if q.query != "bot_type=3" {
|
||||
t.Fatalf("get_bot_qrcode query = %q, want bot_type=3", q.query)
|
||||
}
|
||||
ltl, ok := q.bodyJSON()["local_token_list"]
|
||||
if !ok {
|
||||
t.Fatalf("get_bot_qrcode body missing local_token_list: %s", q.body)
|
||||
}
|
||||
if ltl == nil {
|
||||
t.Fatalf("get_bot_qrcode local_token_list = nil, want empty array []")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestStartLogin_Timeout verifies the bind aborts with ErrLoginTimeout when the QR
|
||||
|
||||
Reference in new issue
Block a user