summaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-12-12 23:33:19 +0800
committerGitHub <noreply@github.com>2020-12-12 16:33:19 +0100
commit9f100a45c6f65d9f41f619d3c683361cad0f72fc (patch)
treea64326a18f120f07f1923316d93687d0dae32ebd /routers/api/v1
parent6074e13c8d26084bc74de38bb7414a971fd5fbf8 (diff)
downloadgitea-9f100a45c6f65d9f41f619d3c683361cad0f72fc.tar.gz
gitea-9f100a45c6f65d9f41f619d3c683361cad0f72fc.zip
Possible fix the webhook API creation (#13960)
* Possible fix the webhook API creation * Fix api create webhook bug
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/utils/hook.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/api/v1/utils/hook.go b/routers/api/v1/utils/hook.go
index c8471184f5..8decc5cf43 100644
--- a/routers/api/v1/utils/hook.go
+++ b/routers/api/v1/utils/hook.go
@@ -6,6 +6,7 @@ package utils
import (
"encoding/json"
+ "fmt"
"net/http"
"strings"
@@ -53,7 +54,7 @@ func GetRepoHook(ctx *context.APIContext, repoID, hookID int64) (*models.Webhook
// write the appropriate error to `ctx`. Return whether the form is valid
func CheckCreateHookOption(ctx *context.APIContext, form *api.CreateHookOption) bool {
if !webhook.IsValidHookTaskType(form.Type) {
- ctx.Error(http.StatusUnprocessableEntity, "", "Invalid hook type")
+ ctx.Error(http.StatusUnprocessableEntity, "", fmt.Sprintf("Invalid hook type: %s", form.Type))
return false
}
for _, name := range []string{"url", "content_type"} {