docstr: This class is used to inject user defined methods within the App Rest API.
  
  Arguments:
      route: The path used to route the requests
      method: The associated flow method
      timeout: The time in seconds taken before raising a timeout exception.
code: def __init__(
      self,
      route: str,
      method: Callable,
      method_name: Optional[str] = None,
      timeout: int = 30,
      **kwargs: Any,
  ):
      """This class is used to inject user defined methods within the App Rest API.
  
      Arguments:
          route: The path used to route the requests
          method: The associated flow method
          timeout: The time in seconds taken before raising a timeout exception.
  
      """
      self.route = route
      self.attached_to_flow = hasattr(method, "__self__")
      self.method_name = method_name or method.__name__
      self.method_annotations = method.__annotations__
      # TODO: Validate the signature contains only pydantic models.
      self.method_signature = inspect.signature(method)
  
      if not self.attached_to_flow:
          self.component_name = method.__name__
          self.method = method
      else:
          self.component_name = method.__self__.name
  
      self.timeout = timeout
      self.kwargs = kwargs
  
      # Enable the users to rely on FastAPI annotation typing with Request.
      # Note: Only a part of the Request functionatilities are supported.
      self._patch_fast_api_request()
  
imports: import asyncio
  import inspect
  import time
  from copy import deepcopy
  from dataclasses import dataclass
  from functools import wraps
  from multiprocessing import Queue
  from typing import Any, Callable, Dict, List, Optional
  from uuid import uuid4
  from fastapi import FastAPI, HTTPException, Request, status
  from lightning_utilities.core.apply_func import apply_to_collection
  from lightning.app.api.request_types import _APIRequest, _CommandRequest, _RequestResponse
  from lightning.app.utilities.app_helpers import Logger
label_desc: Use image node_id 1 to create a new _HttpMethod object  with example: obj = _HttpMethod(route, method, method_name, timeout)