Skip to content

Commit

Permalink
feat(generator): change method character that is always lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
imjuni committed Feb 5, 2024
1 parent e0d3122 commit ae03ab0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions examples/handlers/avengers/heroes/get.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { HTTPMethods } from 'fastify';

export const methods: HTTPMethods = 'SEARCH';

export async function handler() {
return 'hello';
}
3 changes: 2 additions & 1 deletion src/compilers/routes/getRouteHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { validatePropertySignature } from '#/compilers/validators/validateProper
import { validateTypeReferences } from '#/compilers/validators/validateTypeReferences';
import type { IBaseOption } from '#/configs/interfaces/IBaseOption';
import { getImportConfigurationFromResolutions } from '#/generators/getImportConfigurationFromResolutions';
import type { CE_ROUTE_METHOD } from '#/routes/const-enum/CE_ROUTE_METHOD';
import { getExtraMethod } from '#/routes/extractors/getExtraMethod';
import { getRouteMap } from '#/routes/extractors/getRouteMap';
import type { IRouteConfiguration } from '#/routes/interfaces/IRouteConfiguration';
Expand Down Expand Up @@ -79,7 +80,7 @@ export async function getRouteHandler(
);

const routeConfiguration: IRouteConfiguration = {
methods: [routePathConfiguration.method, ...extraMethods],
methods: [routePathConfiguration.method, ...extraMethods].map((method) => method.toLowerCase() as CE_ROUTE_METHOD),
routePath: routePathConfiguration.routePath,
hash,
hasOption: routeOptions.has.option,
Expand Down

0 comments on commit ae03ab0

Please sign in to comment.