Set up timing information for the request.
(self, request: Request)
| 142 | self._dev_tools_initialized = True |
| 143 | |
| 144 | async def _setup_timing(self, request: Request) -> None: |
| 145 | """Set up timing information for the request.""" |
| 146 | try: |
| 147 | request.state.json_body = ( |
| 148 | await request.json() |
| 149 | if request.headers.get("content-type", "").startswith( |
| 150 | "application/json" |
| 151 | ) |
| 152 | else None |
| 153 | ) |
| 154 | except Exception: # pylint: disable=broad-exception-caught |
| 155 | request.state.json_body = None |
| 156 | if self.enable_timing: |
| 157 | request.state.timing_information = { |
| 158 | "__dash_server": {"dur": time.time(), "desc": None} |
| 159 | } |
| 160 | |
| 161 | async def _run_before_hooks(self) -> None: |
| 162 | """Run all before-request hooks.""" |