]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/servers.ts
replace numbers with typed http status codes (#3409)
[github/Chocobozzz/PeerTube.git] / server / middlewares / servers.ts
index 9c0af443a5fa060c35e27af98bba9dd06deab9cd..5e1c165f06d0a98bb1332ae43bf4e4cfcf3b381a 100644 (file)
@@ -1,5 +1,6 @@
 import * as express from 'express'
 import { getHostWithPort } from '../helpers/express-utils'
+import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes'
 
 function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
   if (!req.body.hosts) return next()
@@ -9,7 +10,7 @@ function setBodyHostsPort (req: express.Request, res: express.Response, next: ex
 
     // Problem with the url parsing?
     if (hostWithPort === null) {
-      return res.sendStatus(500)
+      return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR_500)
     }
 
     req.body.hosts[i] = hostWithPort