]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/redis.ts
Import magnets with webtorrent
[github/Chocobozzz/PeerTube.git] / server / lib / redis.ts
index 06a34006012f5e0e6ae96a2e56ff23e16d1af5f9..941f7d5574021b5f91b38bc3034276d13fbab30a 100644 (file)
@@ -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)
   }