mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
REPO-3344: Web Api Parameter required
is not being used (#49)
* REPO-3344: Web Api Parameter `required` is not being used - Added condition that checks if a body is optional and not provided
This commit is contained in:
@@ -171,7 +171,16 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
|
||||
Object jsonContent = null;
|
||||
if (objType != null)
|
||||
{
|
||||
jsonContent = extractJsonContent(req, assistant.getJsonHelper(), objType);
|
||||
// check if the body is optional and is not provided
|
||||
if (!resourceParameter.isRequired() && Integer.valueOf(req.getHeader("content-length")) <= 0)
|
||||
{
|
||||
// in some cases the body is optional and the json doesn't need to be extracted
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonContent = extractJsonContent(req, assistant.getJsonHelper(), objType);
|
||||
}
|
||||
}
|
||||
|
||||
if (isTypeOperation)
|
||||
|
Reference in New Issue
Block a user