Merge pull request #1530 from crazy-max/gotify-token-header

gotify: use X-Gotify-Key header to send token
This commit is contained in:
CrazyMax
2025-11-09 15:48:38 +01:00
committed by GitHub

View File

@@ -86,7 +86,6 @@ func (c *Client) Send(entry model.NotifEntry) error {
u.Path = path.Join(u.Path, "message") u.Path = path.Join(u.Path, "message")
q := u.Query() q := u.Query()
q.Set("token", token)
u.RawQuery = q.Encode() u.RawQuery = q.Encode()
cancelCtx, cancel := context.WithCancelCause(context.Background()) cancelCtx, cancel := context.WithCancelCause(context.Background())
@@ -110,6 +109,7 @@ func (c *Client) Send(entry model.NotifEntry) error {
req.Header.Set("Content-Type", "application/json") req.Header.Set("Content-Type", "application/json")
req.Header.Add("Content-Length", strconv.Itoa(len(string(jsonBody)))) req.Header.Add("Content-Length", strconv.Itoa(len(string(jsonBody))))
req.Header.Set("User-Agent", c.meta.UserAgent) req.Header.Set("User-Agent", c.meta.UserAgent)
req.Header.Set("X-Gotify-Key", token)
resp, err := hc.Do(req) resp, err := hc.Do(req)
if err != nil { if err != nil {