]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/requests/check-api-params.ts
Merge branch 'release/3.3.0' into develop
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / requests / check-api-params.ts
index 7f5ff775cfa05e11478cb9a4c0fe609c48d2f418..26ba1e9132eb6ec783d6e61ad5b59832e85ffd8b 100644 (file)
@@ -1,14 +1,13 @@
+import { HttpStatusCode } from '@shared/models'
 import { makeGetRequest } from './requests'
-import { immutableAssign } from '../miscs/miscs'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
 
 function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
   return makeGetRequest({
     url,
     path,
     token,
-    query: immutableAssign(query, { start: 'hello' }),
-    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
+    query: { ...query, start: 'hello' },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
   })
 }
 
@@ -17,16 +16,16 @@ async function checkBadCountPagination (url: string, path: string, token?: strin
     url,
     path,
     token,
-    query: immutableAssign(query, { count: 'hello' }),
-    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
+    query: { ...query, count: 'hello' },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
   })
 
   await makeGetRequest({
     url,
     path,
     token,
-    query: immutableAssign(query, { count: 2000 }),
-    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
+    query: { ...query, count: 2000 },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
   })
 }
 
@@ -35,8 +34,8 @@ function checkBadSortPagination (url: string, path: string, token?: string, quer
     url,
     path,
     token,
-    query: immutableAssign(query, { sort: 'hello' }),
-    statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
+    query: { ...query, sort: 'hello' },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
   })
 }