@@ -211,10 +211,12 @@ void main() {
211
211
NameValueModel (name: "num" , value: "{{num}}" ),
212
212
],
213
213
);
214
+
214
215
Map <String ?, List <EnvironmentVariableModel >> envMap = {
215
216
kGlobalEnvironmentId: globalVars,
216
217
"activeEnvId" : activeEnvVars,
217
218
};
219
+
218
220
String ? activeEnvironmentId = "activeEnvId" ;
219
221
const expected = HttpRequestModel (
220
222
url: "api.apidash.dev/humanize/social" ,
@@ -227,7 +229,10 @@ void main() {
227
229
);
228
230
expect (
229
231
substituteHttpRequestModel (
230
- httpRequestModel, envMap, activeEnvironmentId),
232
+ httpRequestModel,
233
+ envMap,
234
+ activeEnvironmentId,
235
+ ),
231
236
expected);
232
237
});
233
238
@@ -260,6 +265,40 @@ void main() {
260
265
httpRequestModel, envMap, activeEnvironmentId),
261
266
expected);
262
267
});
268
+
269
+ test (
270
+ "Testing substituteHttpRequestModel with environment variables in body" ,
271
+ () {
272
+ const httpRequestModel = HttpRequestModel (
273
+ url: "{{url}}/humanize/social" ,
274
+ headers: [
275
+ NameValueModel (name: "Authorization" , value: "Bearer {{token}}" ),
276
+ ],
277
+ params: [
278
+ NameValueModel (name: "num" , value: "{{num}}" ),
279
+ ],
280
+ body: "The API key is {{token}} and the number is {{num}}" ,
281
+ );
282
+ Map <String ?, List <EnvironmentVariableModel >> envMap = {
283
+ kGlobalEnvironmentId: globalVars,
284
+ "activeEnvId" : activeEnvVars,
285
+ };
286
+ String ? activeEnvironmentId = "activeEnvId" ;
287
+ const expected = HttpRequestModel (
288
+ url: "api.apidash.dev/humanize/social" ,
289
+ headers: [
290
+ NameValueModel (name: "Authorization" , value: "Bearer token" ),
291
+ ],
292
+ params: [
293
+ NameValueModel (name: "num" , value: "8940000" ),
294
+ ],
295
+ body: "The API key is token and the number is 8940000" ,
296
+ );
297
+ expect (
298
+ substituteHttpRequestModel (
299
+ httpRequestModel, envMap, activeEnvironmentId),
300
+ expected);
301
+ });
263
302
});
264
303
265
304
group ("Testing getEnvironmentTriggerSuggestions function" , () {
0 commit comments