mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
style: styled code
This commit is contained in:
parent
9a3826753d
commit
0d3efd3c79
@ -1,6 +1,9 @@
|
|||||||
import http from 'http'
|
import http from 'http'
|
||||||
import { NextApiResponse } from 'next'
|
import { NextApiResponse } from 'next'
|
||||||
export default function ResponseWrapper(res: NextApiResponse, { code, message, version=2, data, errors }:ResponseProps) {
|
export default function ResponseWrapper(
|
||||||
|
res: NextApiResponse,
|
||||||
|
{ code, message, version = 2, data, errors }: ResponseProps
|
||||||
|
) {
|
||||||
if (!code) throw new Error('`code` is required.')
|
if (!code) throw new Error('`code` is required.')
|
||||||
if (!http.STATUS_CODES[code]) throw new Error('Invalid http code.')
|
if (!http.STATUS_CODES[code]) throw new Error('Invalid http code.')
|
||||||
res.statusCode = code
|
res.statusCode = code
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user