diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/server/redundancy.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'shared/extra-utils/server/redundancy.ts')
-rw-r--r-- | shared/extra-utils/server/redundancy.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/shared/extra-utils/server/redundancy.ts b/shared/extra-utils/server/redundancy.ts index 08467e4c0..3aca4ebfd 100644 --- a/shared/extra-utils/server/redundancy.ts +++ b/shared/extra-utils/server/redundancy.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { makeDeleteRequest, makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' | 1 | import { makeDeleteRequest, makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' |
2 | import { VideoRedundanciesTarget } from '@shared/models' | 2 | import { VideoRedundanciesTarget } from '@shared/models' |
3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
3 | 4 | ||
4 | function updateRedundancy (url: string, accessToken: string, host: string, redundancyAllowed: boolean, expectedStatus = 204) { | 5 | function updateRedundancy (url: string, accessToken: string, host: string, redundancyAllowed: boolean, expectedStatus = 204) { |
5 | const path = '/api/v1/server/redundancy/' + host | 6 | const path = '/api/v1/server/redundancy/' + host |
@@ -20,7 +21,7 @@ function listVideoRedundancies (options: { | |||
20 | start?: number | 21 | start?: number |
21 | count?: number | 22 | count?: number |
22 | sort?: string | 23 | sort?: string |
23 | statusCodeExpected?: number | 24 | statusCodeExpected?: HttpStatusCode |
24 | }) { | 25 | }) { |
25 | const path = '/api/v1/server/redundancy/videos' | 26 | const path = '/api/v1/server/redundancy/videos' |
26 | 27 | ||
@@ -36,7 +37,7 @@ function listVideoRedundancies (options: { | |||
36 | sort: sort ?? 'name', | 37 | sort: sort ?? 'name', |
37 | target | 38 | target |
38 | }, | 39 | }, |
39 | statusCodeExpected: statusCodeExpected || 200 | 40 | statusCodeExpected: statusCodeExpected || HttpStatusCode.OK_200 |
40 | }) | 41 | }) |
41 | } | 42 | } |
42 | 43 | ||
@@ -53,7 +54,7 @@ function addVideoRedundancy (options: { | |||
53 | token: accessToken, | 54 | token: accessToken, |
54 | path, | 55 | path, |
55 | fields: { videoId }, | 56 | fields: { videoId }, |
56 | statusCodeExpected: 204 | 57 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
57 | }) | 58 | }) |
58 | } | 59 | } |
59 | 60 | ||
@@ -69,7 +70,7 @@ function removeVideoRedundancy (options: { | |||
69 | url, | 70 | url, |
70 | token: accessToken, | 71 | token: accessToken, |
71 | path, | 72 | path, |
72 | statusCodeExpected: 204 | 73 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
73 | }) | 74 | }) |
74 | } | 75 | } |
75 | 76 | ||