@@ -121,6 +121,8 @@ async function makeRequest(
121
121
}
122
122
123
123
export class TestEnv {
124
+ private _axiosConfig : AxiosRequestConfig = undefined ;
125
+
124
126
public constructor ( public readonly server : http . Server , public readonly url : string ) {
125
127
this . server = server ;
126
128
this . url = url ;
@@ -165,10 +167,7 @@ export class TestEnv {
165
167
* @param {DataCollectorOptions } options
166
168
* @returns The intercepted envelopes.
167
169
*/
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 > [ ] [ ] > {
172
171
const envelopeTypeArray =
173
172
typeof options . envelopeType === 'string'
174
173
? [ options . envelopeType ]
@@ -180,7 +179,7 @@ export class TestEnv {
180
179
envelopeTypeArray ,
181
180
) ;
182
181
183
- void makeRequest ( options . method , options . url || this . url , axiosConfig ) ;
182
+ void makeRequest ( options . method , options . url || this . url , this . _axiosConfig ) ;
184
183
return resProm ;
185
184
}
186
185
@@ -190,11 +189,8 @@ export class TestEnv {
190
189
* @param {DataCollectorOptions } options
191
190
* @returns The extracted envelope.
192
191
*/
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 ] ;
198
194
}
199
195
200
196
/**
@@ -256,4 +252,8 @@ export class TestEnv {
256
252
. reply ( 200 ) ;
257
253
} ) ;
258
254
}
255
+
256
+ public setAxiosConfig ( axiosConfig : AxiosRequestConfig ) : void {
257
+ this . _axiosConfig = axiosConfig ;
258
+ }
259
259
}
0 commit comments