diag: log raw push body + content-type at INFO level
Temporary diagnostic to see what format Jimi actually sends on /pushalarm. New container is parsing to empty items (pushes arrive but no DB insert), so we need to see the real body shape. Remove once format is confirmed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ef36ebebea
commit
c54794eb4c
1 changed files with 9 additions and 7 deletions
|
|
@ -112,8 +112,12 @@ async def _parse_request(request: Request) -> tuple[str, list[dict]]:
|
||||||
content_type = request.headers.get("content-type", "")
|
content_type = request.headers.get("content-type", "")
|
||||||
body = await request.body()
|
body = await request.body()
|
||||||
|
|
||||||
|
# TEMP DIAGNOSTIC: log every push so we can see what Jimi actually sends.
|
||||||
|
log.info("push %s: content-type=%r body=%.300s",
|
||||||
|
request.url.path, content_type,
|
||||||
|
body.decode("utf-8", errors="replace") if body else "<empty>")
|
||||||
|
|
||||||
if not body:
|
if not body:
|
||||||
log.debug("push: empty request body")
|
|
||||||
return "", []
|
return "", []
|
||||||
|
|
||||||
# ── Try JSON body first (integration push format) ──────────────────────────
|
# ── Try JSON body first (integration push format) ──────────────────────────
|
||||||
|
|
@ -128,11 +132,10 @@ async def _parse_request(request: Request) -> tuple[str, list[dict]]:
|
||||||
items = _parse_data_list(raw_dl)
|
items = _parse_data_list(raw_dl)
|
||||||
else:
|
else:
|
||||||
items = []
|
items = []
|
||||||
log.debug("push: parsed JSON body — %d items", len(items))
|
log.info("push: parsed JSON body — %d items", len(items))
|
||||||
return token, items
|
return token, items
|
||||||
except (json.JSONDecodeError, TypeError):
|
except (json.JSONDecodeError, TypeError):
|
||||||
log.warning("push: JSON body parse failed — body: %.200s",
|
log.warning("push: JSON body parse failed")
|
||||||
body.decode("utf-8", errors="replace"))
|
|
||||||
|
|
||||||
# ── Fall back to form-encoded ───────────────────────────────────────────────
|
# ── Fall back to form-encoded ───────────────────────────────────────────────
|
||||||
try:
|
try:
|
||||||
|
|
@ -140,11 +143,10 @@ async def _parse_request(request: Request) -> tuple[str, list[dict]]:
|
||||||
token = str(form.get("token", ""))
|
token = str(form.get("token", ""))
|
||||||
raw_dl = str(form.get("data_list", ""))
|
raw_dl = str(form.get("data_list", ""))
|
||||||
items = _parse_data_list(raw_dl) if raw_dl else []
|
items = _parse_data_list(raw_dl) if raw_dl else []
|
||||||
log.debug("push: parsed form body — %d items", len(items))
|
log.info("push: parsed form body — %d items", len(items))
|
||||||
return token, items
|
return token, items
|
||||||
except Exception:
|
except Exception:
|
||||||
log.warning("push: form body parse failed — body: %.200s",
|
log.warning("push: form body parse failed", exc_info=True)
|
||||||
body.decode("utf-8", errors="replace"), exc_info=True)
|
|
||||||
|
|
||||||
return "", []
|
return "", []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue