mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
nnya
This commit is contained in:
parent
8e7f08678b
commit
d30bbe56a7
4 changed files with 22 additions and 10 deletions
|
|
@ -1,3 +1,6 @@
|
|||
import { APObject } from "activitypub-types";
|
||||
import { NodeObject } from "jsonld";
|
||||
|
||||
export const jsonResponse = (data: object, status = 200) => {
|
||||
return new Response(JSON.stringify(data), {
|
||||
headers: {
|
||||
|
|
@ -7,6 +10,15 @@ export const jsonResponse = (data: object, status = 200) => {
|
|||
});
|
||||
}
|
||||
|
||||
export const jsonLdResponse = (data: NodeObject | APObject, status = 200) => {
|
||||
return new Response(JSON.stringify(data), {
|
||||
headers: {
|
||||
"Content-Type": "application/activity+json",
|
||||
},
|
||||
status,
|
||||
});
|
||||
};
|
||||
|
||||
export const errorResponse = (error: string, status = 500) => {
|
||||
return jsonResponse({
|
||||
error: error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue