Henrique Santos created UNOMI-935:
-------------------------------------
Summary: Creating segments with bad payloads aren't correctly
managed
Key: UNOMI-935
URL: https://issues.apache.org/jira/browse/UNOMI-935
Project: Apache Unomi
Issue Type: Bug
Components: unomi(-core)
Affects Versions: unomi-3.0.0
Reporter: Henrique Santos
h2. Summary
Creating segments with bad payloads returns 500 errors or doesn't raise errors
h2. Steps to Reproduce
- Deploy Unomi
- Create a segment through the API using bad payloads. Examples:
-- This request returns 500
{code:bash}
curl --location '/cxs/segments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic a2FyYWY6a2FyYWY=' \
--data '{}'
{code}
-- This request returns 500
{code:bash}
curl --location '/cxs/segments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic a2FyYWY6a2FyYWY=' \
--data '{
"metadata": {
"id": "foo"
}
}'
{code}
-- This request returns 500
{code:bash}
curl --location '/cxs/segments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic a2FyYWY6a2FyYWY=' \
--data '{
"metadata": {
"id": "foo"
},
"condition": {
"type": "foo",
"parameterValues": {
"comparisonOperator": "greaterThan",
"propertyName": "properties.numberClicks",
"propertyValueInteger": 3
}
}
}'
{code}
-- This request returns 204, despite raising errors in logs
{code:bash}
curl --location '/cxs/segments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic a2FyYWY6a2FyYWY=' \
--data '{
"metadata": {
"id": "foo"
},
"condition": {
"type": "profilePropertyCondition",
"parameterValues": {
"comparisonOperator": "foo",
"propertyName": "bar",
"propertyValueInteger": 3
}
}
}'
{code}
h2. Actual Result
The bad requests either return 500 errors or get accepted.
h2. Expected Result
The bad requests return 4xx errors (and a descriptive message of what went
wrong).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)