aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/requests/check-api-params.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-07 14:32:36 +0100
committerGitHub <noreply@github.com>2020-12-07 14:32:36 +0100
commit2d53be0267acc49cda46707b885096193a1f4e9c (patch)
tree887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/requests/check-api-params.ts
parentadc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff)
downloadPeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'shared/extra-utils/requests/check-api-params.ts')
-rw-r--r--shared/extra-utils/requests/check-api-params.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/shared/extra-utils/requests/check-api-params.ts b/shared/extra-utils/requests/check-api-params.ts
index c34c7c216..7f5ff775c 100644
--- a/shared/extra-utils/requests/check-api-params.ts
+++ b/shared/extra-utils/requests/check-api-params.ts
@@ -1,5 +1,6 @@
1import { makeGetRequest } from './requests' 1import { makeGetRequest } from './requests'
2import { immutableAssign } from '../miscs/miscs' 2import { immutableAssign } from '../miscs/miscs'
3import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
3 4
4function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { 5function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
5 return makeGetRequest({ 6 return makeGetRequest({
@@ -7,7 +8,7 @@ function checkBadStartPagination (url: string, path: string, token?: string, que
7 path, 8 path,
8 token, 9 token,
9 query: immutableAssign(query, { start: 'hello' }), 10 query: immutableAssign(query, { start: 'hello' }),
10 statusCodeExpected: 400 11 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
11 }) 12 })
12} 13}
13 14
@@ -17,7 +18,7 @@ async function checkBadCountPagination (url: string, path: string, token?: strin
17 path, 18 path,
18 token, 19 token,
19 query: immutableAssign(query, { count: 'hello' }), 20 query: immutableAssign(query, { count: 'hello' }),
20 statusCodeExpected: 400 21 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
21 }) 22 })
22 23
23 await makeGetRequest({ 24 await makeGetRequest({
@@ -25,7 +26,7 @@ async function checkBadCountPagination (url: string, path: string, token?: strin
25 path, 26 path,
26 token, 27 token,
27 query: immutableAssign(query, { count: 2000 }), 28 query: immutableAssign(query, { count: 2000 }),
28 statusCodeExpected: 400 29 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
29 }) 30 })
30} 31}
31 32
@@ -35,7 +36,7 @@ function checkBadSortPagination (url: string, path: string, token?: string, quer
35 path, 36 path,
36 token, 37 token,
37 query: immutableAssign(query, { sort: 'hello' }), 38 query: immutableAssign(query, { sort: 'hello' }),
38 statusCodeExpected: 400 39 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
39 }) 40 })
40} 41}
41 42