mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
handle OPTIONS
method
This commit is contained in:
parent
92f7f81802
commit
1694813321
@ -26,8 +26,13 @@ export default class Engine {
|
||||
})
|
||||
})
|
||||
|
||||
// register body parser
|
||||
await this.app.use(async (req, res, next) => {
|
||||
res.setHeader("Access-Control-Allow-Headers", "Origin, Content-Type, Authorization")
|
||||
|
||||
if (req.method === "OPTIONS") {
|
||||
return res.status(204).end()
|
||||
}
|
||||
|
||||
if (req.headers["content-type"]) {
|
||||
if (!req.headers["content-type"].startsWith("multipart/form-data")) {
|
||||
req.body = await req.urlencoded()
|
||||
|
Loading…
x
Reference in New Issue
Block a user