public request()

in src/api/mock-api-router.ts [117:140]


  public request(method: HttpMethod, uri: string, name: string | undefined, func: MockRequestHandler): void {
    logger.info(`Registering route ${method} ${uri} (${name})`);
    this.trackRegistration(uri, method, name);

    if (this.currentCategory === undefined) {
      throw new Error(
        [
          `Cannot register route ${method} ${uri} (${name}), missing category.`,
          `Please wrap it in:`,
          `app.category("vanilla" | "azure", () => {`,
          `  // app.get(...`,
          `});`,
          "",
        ].join("\n"),
      );
    }
    const category = this.currentCategory;
    if (name) {
      coverageService.register(category, name);
    }
    this.router.route(uri)[method](async (req: RequestExt, res: Response) => {
      await processRequest(category, name, req, res, func);
    });
  }