aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server/config.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-07 14:32:36 +0100
committerGitHub <noreply@github.com>2020-12-07 14:32:36 +0100
commit2d53be0267acc49cda46707b885096193a1f4e9c (patch)
tree887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/server/config.ts
parentadc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff)
downloadPeerTube-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/config.ts')
-rw-r--r--shared/extra-utils/server/config.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts
index 7c1ad0a75..3b6afe9ff 100644
--- a/shared/extra-utils/server/config.ts
+++ b/shared/extra-utils/server/config.ts
@@ -1,6 +1,6 @@
1import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' 1import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
2import { CustomConfig } from '../../models/server/custom-config.model' 2import { CustomConfig } from '../../models/server/custom-config.model'
3import { DeepPartial } from '@shared/core-utils' 3import { DeepPartial, HttpStatusCode } from '@shared/core-utils'
4import { merge } from 'lodash' 4import { merge } from 'lodash'
5 5
6function getConfig (url: string) { 6function getConfig (url: string) {
@@ -9,7 +9,7 @@ function getConfig (url: string) {
9 return makeGetRequest({ 9 return makeGetRequest({
10 url, 10 url,
11 path, 11 path,
12 statusCodeExpected: 200 12 statusCodeExpected: HttpStatusCode.OK_200
13 }) 13 })
14} 14}
15 15
@@ -19,11 +19,11 @@ function getAbout (url: string) {
19 return makeGetRequest({ 19 return makeGetRequest({
20 url, 20 url,
21 path, 21 path,
22 statusCodeExpected: 200 22 statusCodeExpected: HttpStatusCode.OK_200
23 }) 23 })
24} 24}
25 25
26function getCustomConfig (url: string, token: string, statusCodeExpected = 200) { 26function getCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) {
27 const path = '/api/v1/config/custom' 27 const path = '/api/v1/config/custom'
28 28
29 return makeGetRequest({ 29 return makeGetRequest({
@@ -34,7 +34,7 @@ function getCustomConfig (url: string, token: string, statusCodeExpected = 200)
34 }) 34 })
35} 35}
36 36
37function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = 200) { 37function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = HttpStatusCode.OK_200) {
38 const path = '/api/v1/config/custom' 38 const path = '/api/v1/config/custom'
39 39
40 return makePutBodyRequest({ 40 return makePutBodyRequest({
@@ -204,7 +204,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
204 return updateCustomConfig(url, token, updateParams) 204 return updateCustomConfig(url, token, updateParams)
205} 205}
206 206
207function deleteCustomConfig (url: string, token: string, statusCodeExpected = 200) { 207function deleteCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) {
208 const path = '/api/v1/config/custom' 208 const path = '/api/v1/config/custom'
209 209
210 return makeDeleteRequest({ 210 return makeDeleteRequest({