summaryrefslogtreecommitdiffhomepage
path: root/.rules
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-03-18 19:20:40 +0900
committerAdam Malczewski <[email protected]>2026-03-18 19:20:40 +0900
commitbe1f34744feeb9a8783e1158b96028210af04ecc (patch)
tree7dadeeaad72bb2094f45385b7329eafa9b9fd474 /.rules
parent763c5e031f99085e6dace09ff391cdd0177ab5fd (diff)
downloadwebhook-forwarder-be1f34744feeb9a8783e1158b96028210af04ecc.tar.gz
webhook-forwarder-be1f34744feeb9a8783e1158b96028210af04ecc.zip
add changelog
Diffstat (limited to '.rules')
-rw-r--r--.rules/changelog/2026-03/18/02.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/.rules/changelog/2026-03/18/02.md b/.rules/changelog/2026-03/18/02.md
new file mode 100644
index 0000000..1f24ea7
--- /dev/null
+++ b/.rules/changelog/2026-03/18/02.md
@@ -0,0 +1,20 @@
+# 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.