@@ -160,7 +160,7 @@ func (c *AzureDevopsClient) SupportsPatAuthentication() bool {
160160}
161161
162162func (c * AzureDevopsClient ) rest () * resty.Client {
163- var client , err = c .restWithAuthentication ("dev.azure.com" )
163+ var client , err = c .restWithAuthentication (c . restClient , "dev.azure.com" )
164164
165165 if err != nil {
166166 c .logger .Fatalf ("could not create a rest client: %v" , err )
@@ -170,7 +170,7 @@ func (c *AzureDevopsClient) rest() *resty.Client {
170170}
171171
172172func (c * AzureDevopsClient ) restVsrm () * resty.Client {
173- var client , err = c .restWithAuthentication ("vsrm.dev.azure.com" )
173+ var client , err = c .restWithAuthentication (c . restClientVsrm , "vsrm.dev.azure.com" )
174174
175175 if err != nil {
176176 c .logger .Fatalf ("could not create a rest client: %v" , err )
@@ -179,13 +179,13 @@ func (c *AzureDevopsClient) restVsrm() *resty.Client {
179179 return client
180180}
181181
182- func (c * AzureDevopsClient ) restWithAuthentication (domain string ) (* resty.Client , error ) {
183- if c . restClient == nil {
184- c . restClient = c .restWithoutToken (domain )
182+ func (c * AzureDevopsClient ) restWithAuthentication (restClient * resty. Client , domain string ) (* resty.Client , error ) {
183+ if restClient == nil {
184+ restClient = c .restWithoutToken (domain )
185185 }
186186
187187 if c .SupportsPatAuthentication () {
188- c . restClient .SetBasicAuth ("" , * c .accessToken )
188+ restClient .SetBasicAuth ("" , * c .accessToken )
189189 } else {
190190 ctx := context .Background ()
191191 opts := policy.TokenRequestOptions {
@@ -196,10 +196,10 @@ func (c *AzureDevopsClient) restWithAuthentication(domain string) (*resty.Client
196196 panic (err )
197197 }
198198
199- c . restClient .SetBasicAuth ("" , accessToken .Token )
199+ restClient .SetBasicAuth ("" , accessToken .Token )
200200 }
201201
202- return c . restClient , nil
202+ return restClient , nil
203203}
204204
205205func (c * AzureDevopsClient ) restWithoutToken (domain string ) * resty.Client {
0 commit comments