diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
commit | a24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch) | |
tree | a54b0f6c921ba83a6e909cd0ced325b2d4b8863c /shared/extra-utils/feeds/feeds.ts | |
parent | 5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff) | |
parent | c63830f15403ac4e750829f27d8bbbdc9a59282c (diff) | |
download | PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.gz PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.zst PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.zip |
Merge branch 'next' into develop
Diffstat (limited to 'shared/extra-utils/feeds/feeds.ts')
-rw-r--r-- | shared/extra-utils/feeds/feeds.ts | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/shared/extra-utils/feeds/feeds.ts b/shared/extra-utils/feeds/feeds.ts deleted file mode 100644 index ce0a98c6d..000000000 --- a/shared/extra-utils/feeds/feeds.ts +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | import * as request from 'supertest' | ||
2 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
3 | |||
4 | type FeedType = 'videos' | 'video-comments' | 'subscriptions' | ||
5 | |||
6 | function getXMLfeed (url: string, feed: FeedType, format?: string) { | ||
7 | const path = '/feeds/' + feed + '.xml' | ||
8 | |||
9 | return request(url) | ||
10 | .get(path) | ||
11 | .query((format) ? { format: format } : {}) | ||
12 | .set('Accept', 'application/xml') | ||
13 | .expect(HttpStatusCode.OK_200) | ||
14 | .expect('Content-Type', /xml/) | ||
15 | } | ||
16 | |||
17 | function getJSONfeed (url: string, feed: FeedType, query: any = {}, statusCodeExpected = HttpStatusCode.OK_200) { | ||
18 | const path = '/feeds/' + feed + '.json' | ||
19 | |||
20 | return request(url) | ||
21 | .get(path) | ||
22 | .query(query) | ||
23 | .set('Accept', 'application/json') | ||
24 | .expect(statusCodeExpected) | ||
25 | .expect('Content-Type', /json/) | ||
26 | } | ||
27 | |||
28 | // --------------------------------------------------------------------------- | ||
29 | |||
30 | export { | ||
31 | getXMLfeed, | ||
32 | getJSONfeed | ||
33 | } | ||