diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-08 21:16:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 21:16:10 +0100 |
commit | f2eb23cd87cf32b8fe545178143b5f49e06a58da (patch) | |
tree | af7d59945af70e28fd85047e2c688c59a908f548 /server/middlewares/cache.ts | |
parent | c977fd3ec931c059111ddb2b8d6ddbb20b6b99a1 (diff) | |
download | PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.gz PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.zst PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.zip |
emit more specific status codes on video upload (#3423)
- reduce http status codes list to potentially useful codes
- convert more codes to typed ones
- factorize html generator for error responses
Diffstat (limited to 'server/middlewares/cache.ts')
-rw-r--r-- | server/middlewares/cache.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts index cb24d9e0e..0708ee8e8 100644 --- a/server/middlewares/cache.ts +++ b/server/middlewares/cache.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Redis } from '../lib/redis' | 1 | import { Redis } from '../lib/redis' |
2 | import * as apicache from 'apicache' | 2 | import * as apicache from 'apicache' |
3 | import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes' | ||
3 | 4 | ||
4 | // Ensure Redis is initialized | 5 | // Ensure Redis is initialized |
5 | Redis.Instance.init() | 6 | Redis.Instance.init() |
@@ -8,7 +9,10 @@ const defaultOptions = { | |||
8 | redisClient: Redis.Instance.getClient(), | 9 | redisClient: Redis.Instance.getClient(), |
9 | appendKey: () => Redis.Instance.getPrefix(), | 10 | appendKey: () => Redis.Instance.getPrefix(), |
10 | statusCodes: { | 11 | statusCodes: { |
11 | exclude: [ 404, 403 ] | 12 | exclude: [ |
13 | HttpStatusCode.FORBIDDEN_403, | ||
14 | HttpStatusCode.NOT_FOUND_404 | ||
15 | ] | ||
12 | } | 16 | } |
13 | } | 17 | } |
14 | 18 | ||