mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(api): 🏷️ Only allow JSON values in JSON HTTP responses
This commit is contained in:
parent
d4894c362e
commit
8a6d71d958
3 changed files with 12 additions and 3 deletions
|
|
@ -27,8 +27,17 @@ export const response = (
|
|||
});
|
||||
};
|
||||
|
||||
export type Json =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| undefined
|
||||
| Json[]
|
||||
| { [key: string]: Json };
|
||||
|
||||
export const jsonResponse = (
|
||||
data: object,
|
||||
data: Json,
|
||||
status = 200,
|
||||
headers: Record<string, string> = {},
|
||||
) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue