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:
@@ -170,9 +170,18 @@ public class ResourceWebScriptPost extends AbstractResourceWebScript implements
|
|||||||
{
|
{
|
||||||
Object jsonContent = null;
|
Object jsonContent = null;
|
||||||
if (objType != null)
|
if (objType != null)
|
||||||
|
{
|
||||||
|
// 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);
|
jsonContent = extractJsonContent(req, assistant.getJsonHelper(), objType);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isTypeOperation)
|
if (isTypeOperation)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user