1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Prevent headers already sent error

This commit is contained in:
Chocobozzz 2024-08-14 14:21:53 +02:00
parent e6de476ae8
commit 8fe17abb7c
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -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)
}