set headers on options

This commit is contained in:
SrGooglo 2024-04-10 17:47:10 +00:00
parent c046166834
commit 0ee4b4ff4b

View File

@ -27,9 +27,10 @@ export default class Engine {
}) })
await this.app.use(async (req, res, next) => { await this.app.use(async (req, res, next) => {
if (req.method === "OPTIONS") {
res.setHeader("Access-Control-Allow-Origin", "*")
res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Authorization") res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Authorization")
if (req.method === "OPTIONS") {
return res.status(204).end() return res.status(204).end()
} }