1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-07 12:43:31 +08:00

feat: add api port to HTTP post headers.

This commit is contained in:
Mrs4s 2021-07-18 23:04:06 +08:00
parent decab775f9
commit 7274a46a3c
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7

View File

@ -38,6 +38,7 @@ type HTTPClient struct {
secret string
addr string
filter string
apiPort int
timeout int32
}
@ -181,6 +182,7 @@ client:
bot: bot,
secret: c.Secret,
addr: c.URL,
apiPort: conf.Port,
filter: conf.Filter,
timeout: conf.Timeout,
}.Run()
@ -222,6 +224,9 @@ func (c *HTTPClient) onBotPushEvent(e *coolq.Event) {
}
h["X-Signature"] = "sha1=" + hex.EncodeToString(mac.Sum(nil))
}
if c.apiPort != 0 {
h["X-API-Port"] = c.apiPort
}
return h
}()).SetTimeout(time.Second * time.Duration(c.timeout)).F().Retry().Attempt(5).
WaitTime(time.Millisecond * 500).MaxWaitTime(time.Second * 5).