feat: 后端初始化
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { handleOptions, methodNotAllowed } from './http.js'
|
||||
|
||||
export const guardMethod = (request: Request, allowedMethods: string[]) => {
|
||||
if (request.method === 'OPTIONS') {
|
||||
return handleOptions()
|
||||
}
|
||||
|
||||
if (!allowedMethods.includes(request.method)) {
|
||||
return methodNotAllowed(allowedMethods)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user