diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-25 16:22:48 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-25 17:49:48 +0200 |
commit | ebdb612458877465717bc669b40612fa833ff0c9 (patch) | |
tree | 4049731ee3185d2277c51916c16b36874598f161 /server/tests/utils/requests | |
parent | 660d11e91e1643927028d2d6870a911f569b34d8 (diff) | |
download | PeerTube-ebdb612458877465717bc669b40612fa833ff0c9.tar.gz PeerTube-ebdb612458877465717bc669b40612fa833ff0c9.tar.zst PeerTube-ebdb612458877465717bc669b40612fa833ff0c9.zip |
Fix redundancy totalVideos stats
Diffstat (limited to 'server/tests/utils/requests')
-rw-r--r-- | server/tests/utils/requests/requests.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/tests/utils/requests/requests.ts b/server/tests/utils/requests/requests.ts index fc7b38b8c..27a529eda 100644 --- a/server/tests/utils/requests/requests.ts +++ b/server/tests/utils/requests/requests.ts | |||
@@ -7,20 +7,20 @@ function makeGetRequest (options: { | |||
7 | path: string, | 7 | path: string, |
8 | query?: any, | 8 | query?: any, |
9 | token?: string, | 9 | token?: string, |
10 | statusCodeExpected?: number | 10 | statusCodeExpected?: number, |
11 | contentType?: string | ||
11 | }) { | 12 | }) { |
12 | if (!options.statusCodeExpected) options.statusCodeExpected = 400 | 13 | if (!options.statusCodeExpected) options.statusCodeExpected = 400 |
14 | if (options.contentType === undefined) options.contentType = 'application/json' | ||
13 | 15 | ||
14 | const req = request(options.url) | 16 | const req = request(options.url) |
15 | .get(options.path) | 17 | .get(options.path) |
16 | .set('Accept', 'application/json') | ||
17 | 18 | ||
19 | if (options.contentType) req.set('Accept', options.contentType) | ||
18 | if (options.token) req.set('Authorization', 'Bearer ' + options.token) | 20 | if (options.token) req.set('Authorization', 'Bearer ' + options.token) |
19 | if (options.query) req.query(options.query) | 21 | if (options.query) req.query(options.query) |
20 | 22 | ||
21 | return req | 23 | return req.expect(options.statusCodeExpected) |
22 | .expect('Content-Type', /json/) | ||
23 | .expect(options.statusCodeExpected) | ||
24 | } | 24 | } |
25 | 25 | ||
26 | function makeDeleteRequest (options: { | 26 | function makeDeleteRequest (options: { |