fix: BUG-04 webhook JSON Content-Type, BUG-05 obdJson list guard #13

Open
kianiadee wants to merge 1 commit from fix/bugs-04-05 into main

1 commit

Author SHA1 Message Date
david kiania
378682bd57 fix: BUG-04 honour JSON Content-Type in webhook _parse_request, BUG-05 guard obdJson list
Some checks failed
Static Analysis / static (push) Has been cancelled
Tests / test (push) Has been cancelled
Static Analysis / static (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
BUG-04 (MEDIUM): the _parse_request docstring promised "JSON body or
form-encoded body" support, but the implementation only called
request.form(). If Jimi sent application/json (per the docs), the form
parse returned an empty FormData, the function returned ("", []), and
the entire push was silently dropped. Now branches on Content-Type and
parses JSON bodies directly, falling back to the form path that matches
the live Jimi behaviour.

BUG-05 (MEDIUM): push_obd treated obdJson as a dict after json.loads
even though malformed payloads can decode to a list. The subsequent
obd.get(...) raised AttributeError, caught by the per-item except and
logged as a generic "Failed to process" warning — silently losing the
reading. Now coerces lists to their first dict element and falls back
to {} for any other non-dict shape so the timestamp/lat/lng extraction
still runs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:42:17 +03:00