aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/express-utils.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-07 14:32:36 +0100
committerGitHub <noreply@github.com>2020-12-07 14:32:36 +0100
commit2d53be0267acc49cda46707b885096193a1f4e9c (patch)
tree887061a34bc67f40acbb96a6278f9544bf83caeb /server/helpers/express-utils.ts
parentadc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff)
downloadPeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/helpers/express-utils.ts')
-rw-r--r--server/helpers/express-utils.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts
index ba23557ba..c0d3f8f32 100644
--- a/server/helpers/express-utils.ts
+++ b/server/helpers/express-utils.ts
@@ -7,6 +7,7 @@ import { extname } from 'path'
7import { isArray } from './custom-validators/misc' 7import { isArray } from './custom-validators/misc'
8import { CONFIG } from '../initializers/config' 8import { CONFIG } from '../initializers/config'
9import { getExtFromMimetype } from './video' 9import { getExtFromMimetype } from './video'
10import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes'
10 11
11function buildNSFWFilter (res?: express.Response, paramNSFW?: string) { 12function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {
12 if (paramNSFW === 'true') return true 13 if (paramNSFW === 'true') return true
@@ -61,7 +62,9 @@ function getHostWithPort (host: string) {
61} 62}
62 63
63function badRequest (req: express.Request, res: express.Response) { 64function badRequest (req: express.Request, res: express.Response) {
64 return res.type('json').status(400).end() 65 return res.type('json')
66 .status(HttpStatusCode.BAD_REQUEST_400)
67 .end()
65} 68}
66 69
67function createReqFiles ( 70function createReqFiles (