mirror of
https://github.com/foss42/apidash.git
synced 2025-05-20 15:56:34 +08:00
update
This commit is contained in:
@ -86,7 +86,11 @@ HttpRequestModel substituteHttpRequestModel(
|
||||
value: substituteVariables(param.value, envMap, activeEnvironmentId),
|
||||
);
|
||||
}).toList(),
|
||||
body: substituteVariables(httpRequestModel.body, envMap, activeEnvironmentId),
|
||||
body: substituteVariables(
|
||||
httpRequestModel.body,
|
||||
envMap,
|
||||
activeEnvironmentId,
|
||||
),
|
||||
);
|
||||
return newRequestModel;
|
||||
}
|
||||
|
@ -211,10 +211,12 @@ void main() {
|
||||
NameValueModel(name: "num", value: "{{num}}"),
|
||||
],
|
||||
);
|
||||
|
||||
Map<String?, List<EnvironmentVariableModel>> envMap = {
|
||||
kGlobalEnvironmentId: globalVars,
|
||||
"activeEnvId": activeEnvVars,
|
||||
};
|
||||
|
||||
String? activeEnvironmentId = "activeEnvId";
|
||||
const expected = HttpRequestModel(
|
||||
url: "api.apidash.dev/humanize/social",
|
||||
@ -227,7 +229,10 @@ void main() {
|
||||
);
|
||||
expect(
|
||||
substituteHttpRequestModel(
|
||||
httpRequestModel, envMap, activeEnvironmentId),
|
||||
httpRequestModel,
|
||||
envMap,
|
||||
activeEnvironmentId,
|
||||
),
|
||||
expected);
|
||||
});
|
||||
|
||||
@ -260,7 +265,10 @@ void main() {
|
||||
httpRequestModel, envMap, activeEnvironmentId),
|
||||
expected);
|
||||
});
|
||||
test("Testing substituteHttpRequestModel with environment variables in body", () {
|
||||
|
||||
test(
|
||||
"Testing substituteHttpRequestModel with environment variables in body",
|
||||
() {
|
||||
const httpRequestModel = HttpRequestModel(
|
||||
url: "{{url}}/humanize/social",
|
||||
headers: [
|
||||
@ -287,7 +295,8 @@ void main() {
|
||||
body: "The API key is token and the number is 8940000",
|
||||
);
|
||||
expect(
|
||||
substituteHttpRequestModel(httpRequestModel, envMap, activeEnvironmentId),
|
||||
substituteHttpRequestModel(
|
||||
httpRequestModel, envMap, activeEnvironmentId),
|
||||
expected);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user