X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Flib%2Fredis.ts;h=941f7d5574021b5f91b38bc3034276d13fbab30a;hb=ce33919c24e7402d92d81f3cd8e545df52d98240;hp=06a34006012f5e0e6ae96a2e56ff23e16d1af5f9;hpb=19f7b248d88805e6595b671a7447b0ba5e1451fa;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/redis.ts b/server/lib/redis.ts index 06a340060..941f7d557 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts @@ -75,11 +75,12 @@ class Redis { } setCachedRoute (req: express.Request, body: any, lifetime: number, contentType?: string, statusCode?: number) { - const cached: CachedRoute = { - body: body.toString(), - contentType, - statusCode: statusCode.toString() - } + const cached: CachedRoute = Object.assign({}, { + body: body.toString() + }, + (contentType) ? { contentType } : null, + (statusCode) ? { statusCode: statusCode.toString() } : null + ) return this.setObject(this.buildCachedRouteKey(req), cached, lifetime) }