(self, scope: Scope, receive: Receive, send: Send)
| 1244 | return match, child_scope |
| 1245 | |
| 1246 | async def handle(self, scope: Scope, receive: Receive, send: Send) -> None: |
| 1247 | effective_context = _get_scope_effective_route_context(scope) |
| 1248 | if effective_context is not None and effective_context.original_route is self: |
| 1249 | methods = effective_context.methods |
| 1250 | if methods and scope["method"] not in methods: |
| 1251 | headers = {"Allow": ", ".join(methods)} |
| 1252 | if "app" in scope: |
| 1253 | raise HTTPException(status_code=405, headers=headers) |
| 1254 | response = PlainTextResponse( |
| 1255 | "Method Not Allowed", status_code=405, headers=headers |
| 1256 | ) |
| 1257 | await response(scope, receive, send) |
| 1258 | return |
| 1259 | token = _effective_route_context_var.set(effective_context) |
| 1260 | try: |
| 1261 | app = request_response(self.get_route_handler()) |
| 1262 | finally: |
| 1263 | _effective_route_context_var.reset(token) |
| 1264 | await app(scope, receive, send) |
| 1265 | return |
| 1266 | await super().handle(scope, receive, send) |
| 1267 | |
| 1268 | |
| 1269 | @dataclass |
no test coverage detected