(self)
| 217 | |
| 218 | @property |
| 219 | def post_data_json(self) -> Optional[Any]: |
| 220 | post_data = self.post_data |
| 221 | if not post_data: |
| 222 | return None |
| 223 | content_type = self.headers.get("content-type") |
| 224 | if content_type and "application/x-www-form-urlencoded" in content_type: |
| 225 | return dict(parse.parse_qsl(post_data)) |
| 226 | try: |
| 227 | return json.loads(post_data) |
| 228 | except Exception: |
| 229 | raise Error(f"POST data is not a valid JSON object: {post_data}") |
| 230 | |
| 231 | @property |
| 232 | def post_data_buffer(self) -> Optional[bytes]: |