diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /server/middlewares/servers.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/middlewares/servers.ts')
-rw-r--r-- | server/middlewares/servers.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/middlewares/servers.ts b/server/middlewares/servers.ts index 9c0af443a..5e1c165f0 100644 --- a/server/middlewares/servers.ts +++ b/server/middlewares/servers.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getHostWithPort } from '../helpers/express-utils' | 2 | import { getHostWithPort } from '../helpers/express-utils' |
3 | import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes' | ||
3 | 4 | ||
4 | function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { | 5 | function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { |
5 | if (!req.body.hosts) return next() | 6 | if (!req.body.hosts) return next() |
@@ -9,7 +10,7 @@ function setBodyHostsPort (req: express.Request, res: express.Response, next: ex | |||
9 | 10 | ||
10 | // Problem with the url parsing? | 11 | // Problem with the url parsing? |
11 | if (hostWithPort === null) { | 12 | if (hostWithPort === null) { |
12 | return res.sendStatus(500) | 13 | return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR_500) |
13 | } | 14 | } |
14 | 15 | ||
15 | req.body.hosts[i] = hostWithPort | 16 | req.body.hosts[i] = hostWithPort |