1
0
Fork 0
forked from forgejo/forgejo

webhook: matrix use v3 endpoint and drop headers

This commit is contained in:
oliverpool 2024-04-12 09:53:12 +02:00
parent 99830a40a1
commit 94dd22a784
3 changed files with 5 additions and 6 deletions

View file

@ -201,7 +201,7 @@ func TestMatrixJSONPayload(t *testing.T) {
RepoID: 3,
IsActive: true,
Type: webhook_module.MATRIX,
URL: "https://matrix.example.com/_matrix/client/r0/rooms/ROOM_ID/send/m.room.message",
URL: "https://matrix.example.com/_matrix/client/v3/rooms/ROOM_ID/send/m.room.message",
Meta: `{"message_type":0}`, // text
}
task := &webhook_model.HookTask{
@ -217,8 +217,7 @@ func TestMatrixJSONPayload(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, "PUT", req.Method)
assert.Equal(t, "/_matrix/client/r0/rooms/ROOM_ID/send/m.room.message/6db5dc1e282529a8c162c7fe93dd2667494eeb51", req.URL.Path)
assert.Equal(t, "sha256=", req.Header.Get("X-Hub-Signature-256"))
assert.Equal(t, "/_matrix/client/v3/rooms/ROOM_ID/send/m.room.message/6db5dc1e282529a8c162c7fe93dd2667494eeb51", req.URL.Path)
assert.Equal(t, "application/json", req.Header.Get("Content-Type"))
var body MatrixPayload
err = json.NewDecoder(req.Body).Decode(&body)