API: Fix error code for invalid 'attrs' type for POST requests

fixes #5043
This commit is contained in:
Michael Friedrich 2017-03-01 11:33:43 +01:00
parent 2ce3fcc514
commit d3a1f53647
1 changed files with 9 additions and 1 deletions

View File

@ -68,7 +68,15 @@ bool ModifyObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
return true;
}
Dictionary::Ptr attrs = params->Get("attrs");
Value attrsVal = params->Get("attrs");
if (attrsVal.GetReflectionType() != Dictionary::TypeInstance) {
HttpUtility::SendJsonError(response, 400,
"Invalid type for 'attrs' attribute specified. Dictionary type is required.", Empty);
return true;
}
Dictionary::Ptr attrs = attrsVal;
Array::Ptr results = new Array();