summaryrefslogtreecommitdiffstats
path: root/services/webhook/matrix_test.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-06-27 21:21:09 +0200
committerGitHub <noreply@github.com>2021-06-27 20:21:09 +0100
commit9b1b4b543358c212a3da2b480d361d0c1375b279 (patch)
tree2bb767491b82bde8a76bf8b3148f8b7aaae9167c /services/webhook/matrix_test.go
parent0b27b93728fd3cf2ecc82ac6a2b5859270543ef2 (diff)
downloadgitea-9b1b4b543358c212a3da2b480d361d0c1375b279.tar.gz
gitea-9b1b4b543358c212a3da2b480d361d0c1375b279.zip
Refactor Webhook + Add X-Hub-Signature (#16176)
This PR removes multiple unneeded fields from the `HookTask` struct and adds the two headers `X-Hub-Signature` and `X-Hub-Signature-256`. ## :warning: BREAKING :warning: * The `Secret` field is no longer passed as part of the payload. * "Breaking" change (or fix?): The webhook history shows the real called url and not the url registered in the webhook (`deliver.go`@129). Close #16115 Fixes #7788 Fixes #11755 Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'services/webhook/matrix_test.go')
-rw-r--r--services/webhook/matrix_test.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/services/webhook/matrix_test.go b/services/webhook/matrix_test.go
index 7b10e21cfa..451dff6949 100644
--- a/services/webhook/matrix_test.go
+++ b/services/webhook/matrix_test.go
@@ -184,6 +184,8 @@ func TestMatrixJSONPayload(t *testing.T) {
}
func TestMatrixHookRequest(t *testing.T) {
+ w := &models.Webhook{}
+
h := &models.HookTask{
PayloadContent: `{
"body": "[[user1/test](http://localhost:3000/user1/test)] user1 pushed 1 commit to [master](http://localhost:3000/user1/test/src/branch/master):\n[5175ef2](http://localhost:3000/user1/test/commit/5175ef26201c58b035a3404b3fe02b4e8d436eee): Merge pull request 'Change readme.md' (#2) from add-matrix-webhook into master\n\nReviewed-on: http://localhost:3000/user1/test/pulls/2\n - user1",
@@ -245,7 +247,7 @@ func TestMatrixHookRequest(t *testing.T) {
]
}`
- req, err := getMatrixHookRequest(h)
+ req, err := getMatrixHookRequest(w, h)
require.NoError(t, err)
require.NotNil(t, req)