Skip to content

Commit b5a1a2e

Browse files
committed
fix request body format
1 parent ffc9fca commit b5a1a2e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zhook.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ def _safe_hint(s):
444444
raise e
445445

446446
# Post the webhook over Ziti
447-
headers = {'Content-Type': 'application/json'}
448-
data = mwb.dumpJson()
447+
# Build dict payload; requests will set Content-Type when using json=
448+
payload = mwb.body
449449

450450
with openziti.monkeypatch():
451451
# Load the identity inside the context so that the same owner tears down
@@ -462,8 +462,8 @@ def _safe_hint(s):
462462
r = None
463463
try:
464464
session = requests.Session()
465-
print(f"Posting webhook to {url} with headers {headers} and data {data}")
466-
r = session.post(url, headers=headers, data=data)
465+
print(f"Posting webhook to {url} with JSON payload keys {list(payload.keys())}")
466+
r = session.post(url, json=payload)
467467
print(f"Response Status: {r.status_code}")
468468
print(r.headers)
469469
print(r.content)

0 commit comments

Comments
 (0)