From 3545e72c686ff1725bbdfd8d16d693e2f4aa75a3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 12 Oct 2022 16:09:02 +0200 Subject: Put private videos under a specific subdirectory --- shared/server-commands/requests/requests.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'shared/server-commands/requests') diff --git a/shared/server-commands/requests/requests.ts b/shared/server-commands/requests/requests.ts index 8cc1245e0..b247017fd 100644 --- a/shared/server-commands/requests/requests.ts +++ b/shared/server-commands/requests/requests.ts @@ -3,7 +3,7 @@ import { decode } from 'querystring' import request from 'supertest' import { URL } from 'url' -import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { buildAbsoluteFixturePath, pick } from '@shared/core-utils' import { HttpStatusCode } from '@shared/models' export type CommonRequestParams = { @@ -21,10 +21,21 @@ export type CommonRequestParams = { expectedStatus?: HttpStatusCode } -function makeRawRequest (url: string, expectedStatus?: HttpStatusCode, range?: string) { - const { host, protocol, pathname } = new URL(url) +function makeRawRequest (options: { + url: string + token?: string + expectedStatus?: HttpStatusCode + range?: string + query?: { [ id: string ]: string } +}) { + const { host, protocol, pathname } = new URL(options.url) + + return makeGetRequest({ + url: `${protocol}//${host}`, + path: pathname, - return makeGetRequest({ url: `${protocol}//${host}`, path: pathname, expectedStatus, range }) + ...pick(options, [ 'expectedStatus', 'range', 'token', 'query' ]) + }) } function makeGetRequest (options: CommonRequestParams & { -- cgit v1.2.3