Fix 500 error in response.

This commit is contained in:
Mike Cao 2022-03-18 21:24:46 -07:00
parent ffb091c1bc
commit de3bf23e4c

View File

@ -7,11 +7,15 @@ export function json(res, data = {}) {
}
export function send(res, data, type = 'text-plain') {
return res.status(200).setHeader('Content-Type', type).send(data);
res.setHeader('Content-Type', type);
return res.status(200).send(data);
}
export function redirect(res, url) {
return res.status(303).setHeader('Location', url).end();
res.setHeader('Location', url);
return res.status(303).end();
}
export function badRequest(res, msg = '400 Bad Request') {