X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fsearch%2Fvideos.ts;h=5cf8d8cf05d23c072598c3eb574ab421e4ff23df;hb=b91bc1d1f3591c35ab4426f6ab594b4bd9f1ef62;hp=ba46270175f45edc395deb80a450b38c9f83897a;hpb=97567dd81f508dd6295ac4d73d849aa2ce0a6549;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/search/videos.ts b/shared/extra-utils/search/videos.ts index ba4627017..5cf8d8cf0 100644 --- a/shared/extra-utils/search/videos.ts +++ b/shared/extra-utils/search/videos.ts @@ -6,9 +6,11 @@ import { immutableAssign } from '../miscs/miscs' function searchVideo (url: string, search: string) { const path = '/api/v1/search/videos' + + const query = { sort: '-publishedAt', search: search } const req = request(url) .get(path) - .query({ sort: '-publishedAt', search }) + .query(query) .set('Accept', 'application/json') return req.expect(200) @@ -30,11 +32,15 @@ function searchVideoWithToken (url: string, search: string, token: string, query function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) { const path = '/api/v1/search/videos' + const query = { + start, + search, + count + } + const req = request(url) .get(path) - .query({ start }) - .query({ search }) - .query({ count }) + .query(query) if (sort) req.query({ sort }) @@ -46,10 +52,11 @@ function searchVideoWithPagination (url: string, search: string, start: number, function searchVideoWithSort (url: string, search: string, sort: string) { const path = '/api/v1/search/videos' + const query = { search, sort } + return request(url) .get(path) - .query({ search }) - .query({ sort }) + .query(query) .set('Accept', 'application/json') .expect(200) .expect('Content-Type', /json/)