| 4 | |
| 5 | |
| 6 | def parse_body(body: str, content_type: Optional[str]) -> Dict[str, Any]: |
| 7 | if not body: |
| 8 | return {} |
| 9 | if (content_type is not None and content_type == "application/json") or body.startswith("{"): |
| 10 | return json.loads(body) |
| 11 | else: |
| 12 | if "payload" in body: # This is not JSON format yet |
| 13 | params = dict(parse_qsl(body)) |
| 14 | if params.get("payload") is not None: |
| 15 | return json.loads(params.get("payload")) |
| 16 | else: |
| 17 | return {} |
| 18 | else: |
| 19 | return dict(parse_qsl(body)) |
| 20 | |
| 21 | |
| 22 | def extract_is_enterprise_install(payload: Dict[str, Any]) -> Optional[bool]: |