Unify how to take macros parameter

This commit is contained in:
Mattia Codato 2020-06-30 13:51:42 +02:00
parent e4e0115c9d
commit 94be948ff6
1 changed files with 3 additions and 2 deletions

View File

@ -572,8 +572,9 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object,
MacroProcessor::ResolverList resolvers;
if (params->Contains("macros")) {
if (params->Get("macros").IsObjectType<Dictionary>())
resolvers.emplace_back("override",HttpUtility::GetLastParameter(params, "macros"));
Value macros = HttpUtility::GetLastParameter(params, "macros");
if (macros.IsObjectType<Dictionary>())
resolvers.emplace_back("override", macros);
else
return ApiActions::CreateResult(400, "Parameter macros must be a dictionary.");
}