@@ -121,6 +121,8 @@ async function makeRequest(
121121}
122122
123123export class TestEnv {
124+ private _axiosConfig : AxiosRequestConfig = undefined ;
125+
124126 public constructor ( public readonly server : http . Server , public readonly url : string ) {
125127 this . server = server ;
126128 this . url = url ;
@@ -165,10 +167,7 @@ export class TestEnv {
165167 * @param {DataCollectorOptions } options
166168 * @returns The intercepted envelopes.
167169 */
168- public async getMultipleEnvelopeRequest (
169- options : DataCollectorOptions ,
170- axiosConfig ?: AxiosRequestConfig ,
171- ) : Promise < Record < string , unknown > [ ] [ ] > {
170+ public async getMultipleEnvelopeRequest ( options : DataCollectorOptions ) : Promise < Record < string , unknown > [ ] [ ] > {
172171 const envelopeTypeArray =
173172 typeof options . envelopeType === 'string'
174173 ? [ options . envelopeType ]
@@ -180,7 +179,7 @@ export class TestEnv {
180179 envelopeTypeArray ,
181180 ) ;
182181
183- void makeRequest ( options . method , options . url || this . url , axiosConfig ) ;
182+ void makeRequest ( options . method , options . url || this . url , this . _axiosConfig ) ;
184183 return resProm ;
185184 }
186185
@@ -190,11 +189,8 @@ export class TestEnv {
190189 * @param {DataCollectorOptions } options
191190 * @returns The extracted envelope.
192191 */
193- public async getEnvelopeRequest (
194- options ?: DataCollectorOptions ,
195- axiosConfig ?: AxiosRequestConfig ,
196- ) : Promise < Array < Record < string , unknown > > > {
197- return ( await this . getMultipleEnvelopeRequest ( { ...options , count : 1 } , axiosConfig ) ) [ 0 ] ;
192+ public async getEnvelopeRequest ( options ?: DataCollectorOptions ) : Promise < Array < Record < string , unknown > > > {
193+ return ( await this . getMultipleEnvelopeRequest ( { ...options , count : 1 } ) ) [ 0 ] ;
198194 }
199195
200196 /**
@@ -256,4 +252,8 @@ export class TestEnv {
256252 . reply ( 200 ) ;
257253 } ) ;
258254 }
255+
256+ public setAxiosConfig ( axiosConfig : AxiosRequestConfig ) : void {
257+ this . _axiosConfig = axiosConfig ;
258+ }
259259}
0 commit comments