diff options
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/actors/actors.ts | 18 | ||||
-rw-r--r-- | shared/extra-utils/index.ts | 1 | ||||
-rw-r--r-- | shared/extra-utils/requests/requests.ts | 2 |
3 files changed, 2 insertions, 19 deletions
diff --git a/shared/extra-utils/actors/actors.ts b/shared/extra-utils/actors/actors.ts deleted file mode 100644 index 4a4aba775..000000000 --- a/shared/extra-utils/actors/actors.ts +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import { makeGetRequest } from '../requests/requests' | ||
4 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
5 | |||
6 | function getActor (url: string, actorName: string, statusCodeExpected = HttpStatusCode.OK_200) { | ||
7 | const path = '/api/v1/actors/' + actorName | ||
8 | |||
9 | return makeGetRequest({ | ||
10 | url, | ||
11 | path, | ||
12 | statusCodeExpected | ||
13 | }) | ||
14 | } | ||
15 | |||
16 | export { | ||
17 | getActor | ||
18 | } | ||
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index 9f5b5bb28..3bc09ead5 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | export * from './actors/actors' | ||
2 | export * from './bulk/bulk' | 1 | export * from './bulk/bulk' |
3 | 2 | ||
4 | export * from './cli/cli' | 3 | export * from './cli/cli' |
diff --git a/shared/extra-utils/requests/requests.ts b/shared/extra-utils/requests/requests.ts index 8b5cddf4a..38e24d897 100644 --- a/shared/extra-utils/requests/requests.ts +++ b/shared/extra-utils/requests/requests.ts | |||
@@ -26,6 +26,7 @@ function makeGetRequest (options: { | |||
26 | contentType?: string | 26 | contentType?: string |
27 | range?: string | 27 | range?: string |
28 | redirects?: number | 28 | redirects?: number |
29 | accept?: string | ||
29 | }) { | 30 | }) { |
30 | if (!options.statusCodeExpected) options.statusCodeExpected = HttpStatusCode.BAD_REQUEST_400 | 31 | if (!options.statusCodeExpected) options.statusCodeExpected = HttpStatusCode.BAD_REQUEST_400 |
31 | if (options.contentType === undefined) options.contentType = 'application/json' | 32 | if (options.contentType === undefined) options.contentType = 'application/json' |
@@ -36,6 +37,7 @@ function makeGetRequest (options: { | |||
36 | if (options.token) req.set('Authorization', 'Bearer ' + options.token) | 37 | if (options.token) req.set('Authorization', 'Bearer ' + options.token) |
37 | if (options.query) req.query(options.query) | 38 | if (options.query) req.query(options.query) |
38 | if (options.range) req.set('Range', options.range) | 39 | if (options.range) req.set('Range', options.range) |
40 | if (options.accept) req.set('Accept', options.accept) | ||
39 | if (options.redirects) req.redirects(options.redirects) | 41 | if (options.redirects) req.redirects(options.redirects) |
40 | 42 | ||
41 | return req.expect(options.statusCodeExpected) | 43 | return req.expect(options.statusCodeExpected) |