Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f19aff8
Fix webhook exception when empty json data is sent
mikedast Nov 9, 2025
fba504c
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 10, 2025
1089488
fixed typo in comment.
mikedast Nov 10, 2025
b6cc17d
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 10, 2025
b9634e4
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 11, 2025
86d5ef2
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 12, 2025
0211e6f
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 12, 2025
93d5f71
use homeassistant.util.json.json_loads instread of json.loads. Also d…
mikedast Nov 13, 2025
c9a5e2f
re-add text check
mikedast Nov 13, 2025
925476e
Added test
mikedast Nov 15, 2025
95e69fe
renamed test
mikedast Nov 15, 2025
3fee39c
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 15, 2025
bbf2016
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 17, 2025
d0f9c65
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 18, 2025
f559a99
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 19, 2025
4572a34
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 19, 2025
00be452
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 25, 2025
25cac57
inlined code for better readability.
mikedast Nov 26, 2025
8f6b33d
Merge remote-tracking branch 'refs/remotes/origin/fix-webhook-empty-j…
mikedast Nov 26, 2025
a9b7cb5
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Nov 26, 2025
2a81109
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Dec 2, 2025
be25fa3
PR suggestion
mikedast Dec 3, 2025
ea014ec
Improved based on PR comments
mikedast Dec 3, 2025
f08d7b9
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Dec 3, 2025
4db2332
Merge branch 'dev' into fix-webhook-empty-json-exception
mikedast Dec 8, 2025
209a105
reverted exception handling
Dec 8, 2025
1f804ec
reverted exception handling
mikedast Dec 8, 2025
cbf2851
Merge remote-tracking branch 'refs/remotes/origin/fix-webhook-empty-j…
Dec 8, 2025
e5909e3
rebase
Dec 8, 2025
3eb6e43
Merge remote-tracking branch 'refs/remotes/origin/fix-webhook-empty-j…
mikedast Dec 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion homeassistant/components/webhook/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from dataclasses import dataclass
import json
Comment thread
frenck marked this conversation as resolved.
Outdated
import logging
from typing import Any

Expand Down Expand Up @@ -62,7 +63,15 @@ async def _handle_webhook(
base_result: dict[str, Any] = {"platform": "webhook", "webhook_id": webhook_id}

if "json" in request.headers.get(hdrs.CONTENT_TYPE, ""):
base_result["json"] = await request.json()
# Only attempt to parse if theres an actual body
if request.can_read_body:
text = await request.text()
if text.strip():
Comment thread
frenck marked this conversation as resolved.
Outdated
base_result["json"] = json.loads(text)
else:
base_result["json"] = {}
else:
base_result["json"] = {}
else:
base_result["data"] = await request.post()

Expand Down