fix(kit): normalize handler paths (#8626)

This commit is contained in:
Daniel Roe 2022-11-03 10:04:02 -04:00 committed by GitHub
parent d8c41e15b1
commit 7c4899a7ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
import type { NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack'
import { normalize } from 'pathe'
import { useNuxt } from './context'
/**
@ -10,7 +11,8 @@ function normalizeHandlerMethod (handler: NitroEventHandler) {
const [, method = undefined] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || []
return {
method,
...handler
...handler,
handler: normalize(handler.handler)
}
}