diff --git a/packages/core/helpers/router-method-factory.ts b/packages/core/helpers/router-method-factory.ts index c761e2df31f..ff31c57e13a 100644 --- a/packages/core/helpers/router-method-factory.ts +++ b/packages/core/helpers/router-method-factory.ts @@ -1,12 +1,7 @@ import { HttpServer } from '@nestjs/common'; import { RequestMethod } from '@nestjs/common/enums/request-method.enum'; -/** - * Ensures (via satisfies) there's a mapping between the RequestMethod enum and the HttpServer interface. - * @note This is a compile-time check, so if the interface changes, the compiler will complain. - * This is to resolve a case where a new RequestMethod is added, but the RouterMethodFactory is not updated. - */ -const RequestMethodMap = { +const REQUEST_METHOD_MAP = { [RequestMethod.GET]: 'get', [RequestMethod.POST]: 'post', [RequestMethod.PUT]: 'put', @@ -20,10 +15,9 @@ const RequestMethodMap = { export class RouterMethodFactory { public get(target: HttpServer, requestMethod: RequestMethod): Function { - const methodName = RequestMethodMap[requestMethod]; + const methodName = REQUEST_METHOD_MAP[requestMethod]; const method = target[methodName]; if (!method) { - // There should probably be a warning message in this case return target.use; } return method;