diff options
author | techknowlogick <matti@mdranta.net> | 2019-05-15 08:01:53 -0400 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-05-15 20:01:53 +0800 |
commit | 5fb1ad70113d3272232c266b4ff58e9f7f646594 (patch) | |
tree | 6264cc7cba7fbff0d12b638764d4f77d07db6707 /routers | |
parent | 710245e81e0d65c72231dbb3b5c9f860cdc71899 (diff) | |
download | gitea-5fb1ad70113d3272232c266b4ff58e9f7f646594.tar.gz gitea-5fb1ad70113d3272232c266b4ff58e9f7f646594.zip |
Webhook Logs show proper HTTP Method, and allow change HTTP method in form (#6953)
* Fix #6951 - logs show proper HTTP Method, and allow change HTTP method
in form
* enforce POST method for webhook
* set default if method is empty
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/utils/hook.go | 1 | ||||
-rw-r--r-- | routers/repo/webhook.go | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/routers/api/v1/utils/hook.go b/routers/api/v1/utils/hook.go index da15850ec5..92846c5f2a 100644 --- a/routers/api/v1/utils/hook.go +++ b/routers/api/v1/utils/hook.go @@ -98,6 +98,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID URL: form.Config["url"], ContentType: models.ToHookContentType(form.Config["content_type"]), Secret: form.Config["secret"], + HTTPMethod: "POST", HookEvent: &models.HookEvent{ ChooseEvents: true, HookEvents: models.HookEvents{ diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index 7695f208ce..8daf721b50 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -564,6 +564,7 @@ func WebHooksEditPost(ctx *context.Context, form auth.NewWebhookForm) { w.Secret = form.Secret w.HookEvent = ParseHookEvent(form.WebhookForm) w.IsActive = form.Active + w.HTTPMethod = form.HTTPMethod if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return |