From 6b393ac0ceb35e7ca05a8b145707e1ca9ebe90a6 Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Wed, 3 Apr 2024 10:08:25 +0200 Subject: [PATCH] notify: fix #5274: also set 'X-Gotify-Key' header for authentication Versions of Gotify < 2.2.0 only supported the 'X-Gotify-Key' header for passing the API token. This comment sets this header in addition to the regular 'Authorization' header in order to be compatible with older Gotify servers. Signed-off-by: Lukas Wagner --- proxmox-notify/src/endpoints/gotify.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/proxmox-notify/src/endpoints/gotify.rs b/proxmox-notify/src/endpoints/gotify.rs index 90ae959d..20c83bf5 100644 --- a/proxmox-notify/src/endpoints/gotify.rs +++ b/proxmox-notify/src/endpoints/gotify.rs @@ -124,10 +124,13 @@ impl Endpoint for GotifyEndpoint { let body = serde_json::to_vec(&body) .map_err(|err| Error::NotifyFailed(self.name().to_string(), err.into()))?; - let extra_headers = HashMap::from([( - "Authorization".into(), - format!("Bearer {}", self.private_config.token), - )]); + let extra_headers = HashMap::from([ + ( + "Authorization".into(), + format!("Bearer {}", self.private_config.token), + ), + ("X-Gotify-Key".into(), self.private_config.token.clone()), + ]); let proxy_config = context() .http_proxy_config() -- 2.39.2