aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/feeds.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/feeds.ts')
-rw-r--r--server/middlewares/validators/feeds.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts
index 18469bad3..617661813 100644
--- a/server/middlewares/validators/feeds.ts
+++ b/server/middlewares/validators/feeds.ts
@@ -12,6 +12,7 @@ import {
12} from '../../helpers/middlewares' 12} from '../../helpers/middlewares'
13import { doesVideoExist } from '../../helpers/middlewares/videos' 13import { doesVideoExist } from '../../helpers/middlewares/videos'
14import { areValidationErrors } from './utils' 14import { areValidationErrors } from './utils'
15import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
15 16
16const feedsFormatValidator = [ 17const feedsFormatValidator = [
17 param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'), 18 param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'),
@@ -35,7 +36,7 @@ function setFeedFormatContentType (req: express.Request, res: express.Response,
35 if (req.accepts(acceptableContentTypes)) { 36 if (req.accepts(acceptableContentTypes)) {
36 res.set('Content-Type', req.accepts(acceptableContentTypes) as string) 37 res.set('Content-Type', req.accepts(acceptableContentTypes) as string)
37 } else { 38 } else {
38 return res.status(406) 39 return res.status(HttpStatusCode.NOT_ACCEPTABLE_406)
39 .json({ 40 .json({
40 message: `You should accept at least one of the following content-types: ${acceptableContentTypes.join(', ')}` 41 message: `You should accept at least one of the following content-types: ${acceptableContentTypes.join(', ')}`
41 }) 42 })
@@ -105,7 +106,7 @@ const videoCommentsFeedsValidator = [
105 if (areValidationErrors(req, res)) return 106 if (areValidationErrors(req, res)) return
106 107
107 if (req.query.videoId && (req.query.videoChannelId || req.query.videoChannelName)) { 108 if (req.query.videoId && (req.query.videoChannelId || req.query.videoChannelName)) {
108 return res.status(400) 109 return res.status(HttpStatusCode.BAD_REQUEST_400)
109 .json({ 110 .json({
110 message: 'videoId cannot be mixed with a channel filter' 111 message: 'videoId cannot be mixed with a channel filter'
111 }) 112 })