--- name: gitea-merge-form-encoded description: "Merge a Dankclaw Gitea PR with form-encoded do=merge — and the two body failures: 422 [Do]: Required (JSON body) and jsontext invalid character 'd' (form body with Content-Type: application/json header)." --- # Gitea merge on Dankclaw: form-encoded, and nothing else `POST /api/v1/repos///pulls//merge` with `-d 'do=merge&merge_style=no-ff'`. ## The two body failures 1. **JSON body** → `422 {"message":"[Do]: Required"}`. The endpoint reads FORM fields, not JSON. 2. **Form body but a `Content-Type: application/json` header** (e.g. left over in the curl `-K` config file from an earlier PR-body PATCH on the same request setup) → `422 {"message":"[]: jsontext: invalid character 'd' at start of value"}` — Gitea tries to parse `do=merge...` as JSON. ## Working pattern Keep TWO curl config files when a session both patches PR bodies (JSON) and merges (form): ``` # merge.cfg — auth ONLY, no Content-Type header = "Authorization: token $TOKEN" ``` `curl -s -K merge.cfg -X POST -d 'do=merge&merge_style=no-ff' http://192.168.0.143:3000/api/v1/repos///pulls//merge` - Success = **HTTP 200 with an empty body**; verify by landing a checkout (`git ls-remote origin main`), never by re-reading the PR. - PATCH `/pulls/` (title/body) is the opposite: JSON body WITH the Content-Type header. - Token from `~/.config/secrets/gitea` via a 600-perm `-K` file, never `-H` (`/proc//cmdline` is world-readable).