fix(webhooks): gitea_webhooks create always fails with "Missing config option: content_type" #21
Labels
No labels
area/dsh
area/forgejo
experiment
priority/later
priority/next
priority/now
type/bug
type/task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dsh-plugins/dsh-gitea#21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Creating a repository webhook is impossible: the handler sends a
configobject withoutcontent_type, which Forgejo rejects before any webhook is created. The tool schema does not exposecontent_type, so there is no way to satisfy it.Repro
A follow-up
gitea_webhooks {action:"list", owner:"ml-lab", repo:"tardits"}returnedNo webhooks.— nothing was created.Observed vs expected
createis unusable for the defaulttype: "gitea"path.content_type: "json"), optionally overridable via acontent_typeparameter (json/form/multipart).Root cause
lib/handlers/repos.js(webhook create):Forgejo requires
config.content_typeforgiteawebhooks.Proposed fix
Add
content_type: args.content_type || 'json'insideconfig, exposecontent_typeinlib/tool-defs/repos.jsas an enum, and validate it. Live test: create → list shows it → delete withconfirm:true→ list empty.Acceptance: a create with only
url+eventssucceeds and returns the webhook id; the lab repo is left clean.Duplicate check
Searched issues for
webhook(state all) → no existing issue.Layer
dsh-gitea plugin/tool.
Fixed in
281eade(PR #40).Webhook create now sends
config.content_type(jsondefault,json|form|multipartaccepted and validated) and requiresurl. Added a formatter so the result isWebhook #1 created (type gitea).and list rows are readable.Live on
ml-lab/tardits: create with onlyurl+events→Webhook #1 created (type gitea).; list → one; deleteconfirm:true→ list →No webhooks.(lab left clean).Tests:
test/qa-defaults.test.mjs.