From 9b517179dc9054dfd1d41d189aa353082a412748 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 14 Aug 2024 14:15:56 +0300 Subject: [PATCH] federation: fix signing requests with no body --- federation/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/federation/client.go b/federation/client.go index dc8c139c..d49ba560 100644 --- a/federation/client.go +++ b/federation/client.go @@ -332,12 +332,16 @@ func (c *Client) compileRequest(ctx context.Context, params RequestParams) (*htt Message: "client not configured for authentication", } } + var contentAny any + if reqJSON != nil { + contentAny = reqJSON + } auth, err := (&signableRequest{ Method: req.Method, URI: reqURL.RequestURI(), Origin: c.ServerName, Destination: params.ServerName, - Content: reqJSON, + Content: contentAny, }).Sign(c.Key) if err != nil { return nil, mautrix.HTTPError{