Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Prevent headers already sent error

Chocobozzz8fe17abb7c6b
diff --git a/server/core/controllers/activitypub/utils.ts b/server/core/controllers/activitypub/utils.ts
index 5de38eb434..3954a1105b 100644
--- a/server/core/controllers/activitypub/utils.ts
+++ b/server/core/controllers/activitypub/utils.ts
@@ -1,12 +1,11 @@
import express from 'express'
-async function activityPubResponse (promise: Promise<any>, res: express.Response) {
+export async function activityPubResponse (promise: Promise<any>, res: express.Response) {
const data = await promise
- return res.type('application/activity+json; charset=utf-8')
- .json(data)
-}
+ if (!res.headersSent) {
+ res.type('application/activity+json; charset=utf-8')
+ }
-export {
- activityPubResponse
+ return res.json(data)
}