fix(core): CORS middleware should not process the entire handler chain on OPTIONS requests (no-changelog) (#5368)

fix(core): CORS middleware should not process the entire handler chain on OPTIONS requests
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-02-06 12:43:50 +01:00
committed by GitHub
parent e4458b48e0
commit a115baa1ac

View File

@@ -11,5 +11,10 @@ export const corsMiddleware: RequestHandler = (req, res, next) => {
'Origin, X-Requested-With, Content-Type, Accept, sessionid',
);
}
if (req.method === 'OPTIONS') {
res.writeHead(204).end();
} else {
next();
}
};