]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/utils/requests/check-api-params.ts
Remove tmp file on image processing error
[github/Chocobozzz/PeerTube.git] / shared / utils / requests / check-api-params.ts
CommitLineData
eec63bbc 1import { makeGetRequest } from './requests'
d175a6f7 2import { immutableAssign } from '../miscs/miscs'
eec63bbc 3
d525fc39 4function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
eec63bbc
C
5 return makeGetRequest({
6 url,
7 path,
93e4a311 8 token,
d525fc39 9 query: immutableAssign(query, { start: 'hello' }),
eec63bbc
C
10 statusCodeExpected: 400
11 })
12}
13
d525fc39 14function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
eec63bbc
C
15 return makeGetRequest({
16 url,
17 path,
93e4a311 18 token,
d525fc39 19 query: immutableAssign(query, { count: 'hello' }),
eec63bbc
C
20 statusCodeExpected: 400
21 })
22}
23
d525fc39 24function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
eec63bbc
C
25 return makeGetRequest({
26 url,
27 path,
93e4a311 28 token,
d525fc39 29 query: immutableAssign(query, { sort: 'hello' }),
eec63bbc
C
30 statusCodeExpected: 400
31 })
32}
33
34// ---------------------------------------------------------------------------
35
36export {
37 checkBadStartPagination,
38 checkBadCountPagination,
39 checkBadSortPagination
40}