chore(lint): add safe fallbacks for Nitro globals (getMethod/getRequestURL) in passkey and middleware handlers
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
*/
|
||||
|
||||
export default defineEventHandler((event) => {
|
||||
const getRequestURL = globalThis.getRequestURL ?? ((e) => {
|
||||
try { return new URL(e?.req?.url, 'http://localhost') } catch { return { href: String(e?.req?.url || ''), pathname: String(e?.req?.url || '').split('?')[0] || '' } }
|
||||
})
|
||||
const getMethod = globalThis.getMethod ?? ((e) => (e?.req?.method || e?.method || 'GET'))
|
||||
const url = getRequestURL(event)
|
||||
const method = getMethod(event)
|
||||
const path = url.pathname
|
||||
|
||||
Reference in New Issue
Block a user