@@ -47,7 +47,9 @@ export default class httpClient {
4747
4848
4949 this . axiosInstance . interceptors . request . use ( ( config ) => {
50- config . headers [ 'projectToken' ] = this . projectToken ;
50+ if ( ! config . headers [ 'projectToken' ] ) {
51+ config . headers [ 'projectToken' ] = this . projectToken ;
52+ }
5153 config . headers [ 'projectName' ] = this . projectName ;
5254 config . headers [ 'username' ] = this . username ;
5355 config . headers [ 'accessKey' ] = this . accessKey ;
@@ -175,18 +177,15 @@ export default class httpClient {
175177
176178
177179 getSmartUICapabilities ( sessionId : string , config : any , git : any , log : Logger ) {
178- console . log ( `get smartui caps api called with sessionId: ${ sessionId } ` ) ;
179- const serializedConfig = JSON . stringify ( config ) ;
180- const serializedGit = JSON . stringify ( git ) ;
181- console . log ( `Serialized Config: ${ serializedConfig } ` ) ;
182- console . log ( `Serialized Git: ${ serializedGit } ` ) ;
183180 return this . request ( {
184181 url : '/sessions/capabilities' ,
185182 method : 'GET' ,
186183 params : {
187184 sessionId : sessionId ,
188- config : serializedConfig ,
189- git : serializedGit ,
185+ } ,
186+ data : {
187+ git,
188+ config
190189 } ,
191190 headers : {
192191 projectToken : '' ,
@@ -208,33 +207,24 @@ export default class httpClient {
208207 } , log )
209208 }
210209
211- async finalizeBuildForCapsWithToken ( buildId : string , totalSnapshots : number , projectToken : string , log : Logger ) : Promise < void > {
212- try {
213- let params : Record < string , string | number > = { buildId } ;
214- if ( totalSnapshots > - 1 ) params . totalSnapshots = totalSnapshots ;
215-
216- await this . request ( {
217- url : '/build' ,
218- method : 'DELETE' ,
219- params : params ,
220- headers : {
221- projectToken : projectToken , // Use projectToken dynamically
222- } ,
223- } , log ) ;
224-
225- log . debug ( `Successfully finalized build ${ buildId } with ${ totalSnapshots } snapshots and projectToken ${ projectToken } ` ) ;
226- } catch ( error : any ) {
227- log . debug ( `Failed to finalize build ${ buildId } : ${ error . message } ` ) ;
228- throw error ; // Re-throw error for further handling if necessary
229- }
210+ finalizeBuildForCapsWithToken ( buildId : string , totalSnapshots : number , projectToken : string , log : Logger ) {
211+ let params : Record < string , string | number > = { buildId } ;
212+ if ( totalSnapshots > - 1 ) params . totalSnapshots = totalSnapshots ;
213+ return this . request ( {
214+ url : '/build' ,
215+ method : 'DELETE' ,
216+ params : params ,
217+ headers : {
218+ projectToken : projectToken , // Use projectToken dynamically
219+ } ,
220+ } , log ) ;
230221 }
231222
232223
233- uploadSnapshot ( ctx : Context , snapshot : ProcessedSnapshot , capsBuildId : string ) {
224+ uploadSnapshot ( ctx : Context , snapshot : ProcessedSnapshot ) {
234225 // Use capsBuildId if provided, otherwise fallback to ctx.build.id
235- const buildId = capsBuildId !== '' ? capsBuildId : ctx . build . id ;
236226 return this . request ( {
237- url : `/builds/${ buildId } /snapshot` ,
227+ url : `/builds/${ ctx . build . id } /snapshot` ,
238228 method : 'POST' ,
239229 headers : { 'Content-Type' : 'application/json' } ,
240230 data : {
@@ -244,7 +234,7 @@ export default class httpClient {
244234 source : 'cli'
245235 }
246236 }
247- } , ctx . log ) ;
237+ } , ctx . log )
248238 }
249239
250240 processSnapshot ( ctx : Context , snapshot : ProcessedSnapshot , snapshotUuid : string ) {
0 commit comments