diff options
Diffstat (limited to 'shared/server-commands/requests')
-rw-r--r-- | shared/server-commands/requests/check-api-params.ts | 48 | ||||
-rw-r--r-- | shared/server-commands/requests/index.ts | 2 | ||||
-rw-r--r-- | shared/server-commands/requests/requests.ts | 2 |
3 files changed, 1 insertions, 51 deletions
diff --git a/shared/server-commands/requests/check-api-params.ts b/shared/server-commands/requests/check-api-params.ts deleted file mode 100644 index 26ba1e913..000000000 --- a/shared/server-commands/requests/check-api-params.ts +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | ||
2 | import { makeGetRequest } from './requests' | ||
3 | |||
4 | function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { | ||
5 | return makeGetRequest({ | ||
6 | url, | ||
7 | path, | ||
8 | token, | ||
9 | query: { ...query, start: 'hello' }, | ||
10 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
11 | }) | ||
12 | } | ||
13 | |||
14 | async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) { | ||
15 | await makeGetRequest({ | ||
16 | url, | ||
17 | path, | ||
18 | token, | ||
19 | query: { ...query, count: 'hello' }, | ||
20 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
21 | }) | ||
22 | |||
23 | await makeGetRequest({ | ||
24 | url, | ||
25 | path, | ||
26 | token, | ||
27 | query: { ...query, count: 2000 }, | ||
28 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
29 | }) | ||
30 | } | ||
31 | |||
32 | function checkBadSortPagination (url: string, path: string, token?: string, query = {}) { | ||
33 | return makeGetRequest({ | ||
34 | url, | ||
35 | path, | ||
36 | token, | ||
37 | query: { ...query, sort: 'hello' }, | ||
38 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
39 | }) | ||
40 | } | ||
41 | |||
42 | // --------------------------------------------------------------------------- | ||
43 | |||
44 | export { | ||
45 | checkBadStartPagination, | ||
46 | checkBadCountPagination, | ||
47 | checkBadSortPagination | ||
48 | } | ||
diff --git a/shared/server-commands/requests/index.ts b/shared/server-commands/requests/index.ts index 501163f92..802982301 100644 --- a/shared/server-commands/requests/index.ts +++ b/shared/server-commands/requests/index.ts | |||
@@ -1,3 +1 @@ | |||
1 | // Don't include activitypub that import stuff from server | ||
2 | export * from './check-api-params' | ||
3 | export * from './requests' | export * from './requests' | |
diff --git a/shared/server-commands/requests/requests.ts b/shared/server-commands/requests/requests.ts index b6b9024ed..95e4fe6b1 100644 --- a/shared/server-commands/requests/requests.ts +++ b/shared/server-commands/requests/requests.ts | |||
@@ -3,8 +3,8 @@ | |||
3 | import { decode } from 'querystring' | 3 | import { decode } from 'querystring' |
4 | import request from 'supertest' | 4 | import request from 'supertest' |
5 | import { URL } from 'url' | 5 | import { URL } from 'url' |
6 | import { buildAbsoluteFixturePath } from '@shared/core-utils' | ||
6 | import { HttpStatusCode } from '@shared/models' | 7 | import { HttpStatusCode } from '@shared/models' |
7 | import { buildAbsoluteFixturePath } from '../miscs/tests' | ||
8 | 8 | ||
9 | export type CommonRequestParams = { | 9 | export type CommonRequestParams = { |
10 | url: string | 10 | url: string |