-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Closed
Labels
Description
My environments are Rails and Mysql and Gitea
Gitea create webhook api :
# api
/repos/{owner}/{repo}/hooks
# params:
{
"active": false,
"branch_filter": "string",
"config": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"events": [
"string"
],
"type": "dingtalk"
}
When I use this api to create webhook with custom params
I get errors which say RequiredError
# custom params:
hook_params = {
active: true,
branch_filter: "*",
config: {
content_type: "application/json",
url: "xx/repositories/2222/repo_hooks.json",
http_method: "post"
},
events: ["create", "pull", "push"],
type: "gitea",
}
Response Errors Logs
...
I, [2020-05-12T10:19:32.254166 #86437] INFO -- request: POST xxxx/api/v1/repos/ownner/repo_name/hooks
D, [2020-05-12T10:19:32.254238 #86437] DEBUG -- request: Content-Type: "application/json"
...
User-Agent: "Faraday v0.15.4"
I, [2020-05-12T10:19:32.698568 #86437] INFO -- response: Status 422
D, [2020-05-12T10:19:32.698731 #86437] DEBUG -- response: server: "nginx/1.10.1"
date: "Tue, 12 May 2020 02:19:32 GMT"
content-type: "application/json; charset=utf-8"
content-length: "159"
connection: "close"
...
###############____response__#<Faraday::Response:0x00007f942fcd7330>
###############____response_status_422
###############____response_body_[{"fieldNames":["Type"],"classification":"RequiredError","message":"Required"},{"fieldNames":["Config"],"classification":"RequiredError","message":"Required"}]
...
I had changed hook_params.type to hook_params.Type, and the same to hook_params.Config, but it seems do not work also.
Is my hook_params wrong? and how to fix hook_params?
TKS~