fix: CORS not working because of auth headers

This commit is contained in:
diced 2022-11-24 14:17:46 -08:00
parent 1b6af9fc08
commit 0dbbf4840c
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1

View file

@ -66,6 +66,8 @@ export const withZipline =
res.setHeader('Access-Content-Allow-Methods', api_config.methods.join(','));
res.setHeader('Access-Control-Max-Age', '86400');
if (req.method === 'OPTIONS') return res.status(204).end();
// Used when the client sends wrong information, etc.
res.badRequest = (message: string, extra: Record<string, any> = {}) => {
res.json(
@ -140,6 +142,7 @@ export const withZipline =
const unsigned = unsign64(cookie, config.core.secret);
return unsigned ? unsigned : null;
};
req.cleanCookie = (name: string) => {
res.setHeader(
'Set-Cookie',