mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
Set content type for responses.
This commit is contained in:
parent
f24696de5a
commit
63bfa616f1
@ -6,14 +6,12 @@ export function json(res, data = {}) {
|
||||
return res.status(200).json(data);
|
||||
}
|
||||
|
||||
export function send(res, data) {
|
||||
return res.status(200).send(data);
|
||||
export function send(res, data, type = 'text-plain') {
|
||||
return res.status(200).setHeader('Content-Type', type).send(data);
|
||||
}
|
||||
|
||||
export function redirect(res, url) {
|
||||
res.setHeader('Location', url);
|
||||
|
||||
return res.status(303).end();
|
||||
return res.status(303).setHeader('Location', url).end();
|
||||
}
|
||||
|
||||
export function badRequest(res, msg = '400 Bad Request') {
|
||||
|
Loading…
Reference in New Issue
Block a user