Merge pull request #288 from vitobotta/master

Fix CORS error when IGNORE_IP is set
This commit is contained in:
Mike Cao 2020-10-09 11:00:42 -07:00 committed by GitHub
commit 6539fd4016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,8 @@ import { createToken } from 'lib/crypto';
import { getIpAddress } from '../../lib/request'; import { getIpAddress } from '../../lib/request';
export default async (req, res) => { export default async (req, res) => {
await useCors(req, res);
if (isBot(req.headers['user-agent'])) { if (isBot(req.headers['user-agent'])) {
return ok(res); return ok(res);
} }
@ -19,7 +21,6 @@ export default async (req, res) => {
} }
} }
await useCors(req, res);
await useSession(req, res); await useSession(req, res);
const { type, payload } = req.body; const { type, payload } = req.body;