]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/feeds/feeds.ts
Translated using Weblate (German)
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / feeds / feeds.ts
index bafbb9f943e4013ec99b02a2afae145fb5992508..ce0a98c6d65dc4a9e1e86ffe4259227f886bb257 100644 (file)
@@ -1,4 +1,5 @@
 import * as request from 'supertest'
+import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
 
 type FeedType = 'videos' | 'video-comments' | 'subscriptions'
 
@@ -9,18 +10,18 @@ function getXMLfeed (url: string, feed: FeedType, format?: string) {
           .get(path)
           .query((format) ? { format: format } : {})
           .set('Accept', 'application/xml')
-          .expect(200)
+          .expect(HttpStatusCode.OK_200)
           .expect('Content-Type', /xml/)
 }
 
-function getJSONfeed (url: string, feed: FeedType, query: any = {}) {
+function getJSONfeed (url: string, feed: FeedType, query: any = {}, statusCodeExpected = HttpStatusCode.OK_200) {
   const path = '/feeds/' + feed + '.json'
 
   return request(url)
           .get(path)
           .query(query)
           .set('Accept', 'application/json')
-          .expect(200)
+          .expect(statusCodeExpected)
           .expect('Content-Type', /json/)
 }