]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/utils/feeds/feeds.ts
ffmpeg auto thread
[github/Chocobozzz/PeerTube.git] / server / tests / utils / feeds / feeds.ts
CommitLineData
966eb053
RK
1import * as request from 'supertest'
2import { readFileBufferPromise } from '../../../helpers/core-utils'
3
fe3a55b0
C
4type FeedType = 'videos' | 'video-comments'
5
6function getXMLfeed (url: string, feed: FeedType, format?: string) {
7 const path = '/feeds/' + feed + '.xml'
966eb053
RK
8
9 return request(url)
10 .get(path)
11 .query((format) ? { format: format } : {})
12 .set('Accept', 'application/xml')
13 .expect(200)
14 .expect('Content-Type', /xml/)
15}
16
fe3a55b0
C
17function getJSONfeed (url: string, feed: FeedType) {
18 const path = '/feeds/' + feed + '.json'
966eb053
RK
19
20 return request(url)
21 .get(path)
22 .set('Accept', 'application/json')
23 .expect(200)
24 .expect('Content-Type', /json/)
25}
26
27// ---------------------------------------------------------------------------
28
29export {
30 getXMLfeed,
31 getJSONfeed
32}