File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ interface BaseModelOptions {
8
8
oauthToken ?: string ;
9
9
useXMLHttpRequest ?: boolean ;
10
10
version ?: string ;
11
+ sudo ?: boolean ;
11
12
rejectUnauthorized ?: boolean ;
12
13
}
13
14
@@ -23,6 +24,7 @@ class BaseModel {
23
24
constructor ( {
24
25
token,
25
26
oauthToken,
27
+ sudo,
26
28
url = 'https://gitlab.com' ,
27
29
useXMLHttpRequest = false ,
28
30
version = 'v4' ,
@@ -34,11 +36,12 @@ class BaseModel {
34
36
this . useXMLHttpRequest = useXMLHttpRequest ;
35
37
this . rejectUnauthorized = rejectUnauthorized ;
36
38
37
- if ( oauthToken ) {
38
- this . headers . authorization = `Bearer ${ oauthToken } ` ;
39
- } else if ( token ) {
40
- this . headers [ 'private-token' ] = token ;
41
- }
39
+ // Handle auth tokens
40
+ if ( oauthToken ) this . headers . authorization = `Bearer ${ oauthToken } ` ;
41
+ else if ( token ) this . headers [ 'private-token' ] = token ;
42
+
43
+ // Set sudo
44
+ if ( sudo ) this . headers [ 'Sudo' ] = sudo ;
42
45
}
43
46
}
44
47
You can’t perform that action at this time.
0 commit comments