fix: set header first

This commit is contained in:
wonderlandpark 2021-05-29 21:52:42 +09:00
parent f7ed8b233d
commit 08342bca6d

View File

@ -7,8 +7,8 @@ export default function ResponseWrapper<T = unknown>(
) {
if (!code) throw new Error('`code` is required.')
if (!http.STATUS_CODES[code]) throw new Error('Invalid http code.')
res.status(code)
res.setHeader('Access-Control-Allow-Origin', process.env.KOREANBOTS_URL)
res.status(code)
res.json({
code,
data,