Skip to content

Commit

Permalink
Fix route registration
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym committed Jun 12, 2024
1 parent 021a297 commit 9dcfc41
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/adapters/hono.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function fromHono<M>(
path: route,
nestedRouter: handlers[0],
})
} else if (prop !== 'all') {
} else if (openapiRouter.allowedMethods.includes(prop)) {
handlers = openapiRouter.registerRoute({
method: prop,
path: route,
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/ittyRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function fromIttyRouter<M>(
path: route,
nestedRouter: handlers[0],
})
} else if (prop !== 'all') {
} else if (openapiRouter.allowedMethods.includes(prop)) {
handlers = openapiRouter.registerRoute({
method: prop,
path: route,
Expand Down
2 changes: 2 additions & 0 deletions src/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export class OpenAPIHandler {
options: RouterOptions
registry: OpenAPIRegistryMerger

allowedMethods = ['get', 'head', 'post', 'put', 'delete', 'patch']

constructor(router: any, options?: RouterOptions) {
this.router = router
this.options = options || {}
Expand Down

0 comments on commit 9dcfc41

Please sign in to comment.