diag: log raw push body to identify Jimi format #7
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", "")
|
||||
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:
|
||||
log.debug("push: empty request body")
|
||||
return "", []
|
||||
|
||||
# ── 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)
|
||||
else:
|
||||
items = []
|
||||
log.debug("push: parsed JSON body — %d items", len(items))
|
||||
log.info("push: parsed JSON body — %d items", len(items))
|
||||
return token, items
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
log.warning("push: JSON body parse failed — body: %.200s",
|
||||
body.decode("utf-8", errors="replace"))
|
||||
log.warning("push: JSON body parse failed")
|
||||
|
||||
# ── Fall back to form-encoded ───────────────────────────────────────────────
|
||||
try:
|
||||
|
|
@ -140,11 +143,10 @@ async def _parse_request(request: Request) -> tuple[str, list[dict]]:
|
|||
token = str(form.get("token", ""))
|
||||
raw_dl = str(form.get("data_list", ""))
|
||||
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
|
||||
except Exception:
|
||||
log.warning("push: form body parse failed — body: %.200s",
|
||||
body.decode("utf-8", errors="replace"), exc_info=True)
|
||||
log.warning("push: form body parse failed", exc_info=True)
|
||||
|
||||
return "", []
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue