Prevent headers sent error

This commit is contained in:
Chocobozzz 2022-07-18 15:41:47 +02:00
parent ace01da348
commit cace0d1a71
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,10 @@
const advertiseDoNotTrack = (_, res, next) => {
res.setHeader('Tk', 'N')
import * as express from 'express'
const advertiseDoNotTrack = (_, res: express.Response, next: express.NextFunction) => {
if (!res.headersSent) {
res.setHeader('Tk', 'N')
}
return next()
}