fix(kook): KOOK 机器人鉴权用 Authorization: Bot <token> 而非 Bearer
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

httpclient 硬编码 Bearer,导致 KOOK bot token 被当 OAuth2 用户令牌发,
/ gateway/index 返回 401『登录环境异常』。按 KOOK reference 鉴权规范,
给共享 httpclient 增加可配置 authScheme(默认 Bearer),KOOK 用 Bot。

- httpclient: 新增 WithAuthScheme 选项 + authScheme 字段,do() 按 scheme 组装
- kook/adapter: 装配时传 WithAuthScheme("Bot")
- 同步修正 config.go 注释与 send/identity 测试断言
This commit is contained in:
Aska committed 2026-09-07 16:59:53 +08:00
1 parent e9df928072
commit c1bd740f7c
5 files changed
+36 -18

No files matched your search

+2 -2
View File
@@ -38,8 +38,8 @@ func TestSendMessage_GroupText(t *testing.T) {
}
mu.Lock()
defer mu.Unlock()
if auth != "Bearer testtoken" {
t.Errorf("Authorization = %q, want Bearer testtoken", auth)
if auth != "Bot testtoken" {
t.Errorf("Authorization = %q, want Bot testtoken", auth)
}
if body["target_id"] != "chan-1" {
t.Errorf("target_id = %v, want chan-1", body["target_id"])