# Convert form-urlencoded webhook payloads to JSON ## Problem GitHub webhooks default to `Content-Type: application/x-www-form-urlencoded`, sending the JSON payload URL-encoded under a `payload` form field. Dokploy expects `application/json` bodies, so `req.body.ref` was `undefined`, causing a `{"message":"Branch Not Match"}` error on every push event. ## Changes ### `Cargo.toml` - Added `form_urlencoded = "1"` dependency for parsing URL-encoded form data. ### `src/main.rs` - Added `content_type_is_form_urlencoded()` helper to detect form-urlencoded requests. - Added `extract_json_from_form()` helper to extract the `payload` field and return raw JSON bytes. - Clone request headers before consuming the body so Content-Type can be inspected. - When a form-urlencoded payload is detected, extract the JSON and override the `Content-Type` header to `application/json` before forwarding to Dokploy. - Requests already using `application/json` pass through unchanged. ### `bin/test.sh` - Added Test 6: verifies form-urlencoded payloads with a `payload` field are forwarded correctly.