From 7274a46a3c505ecf5b2125358dddc26982a43b94 Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Sun, 18 Jul 2021 23:04:06 +0800 Subject: [PATCH] feat: add api port to HTTP post headers. --- server/http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/http.go b/server/http.go index 9488d88..ca81d88 100644 --- a/server/http.go +++ b/server/http.go @@ -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).