Henrique Santos created UNOMI-934:
-------------------------------------
Summary: Creating rules with bad payloads doesn't raise errors
Key: UNOMI-934
URL: https://issues.apache.org/jira/browse/UNOMI-934
Project: Apache Unomi
Issue Type: Bug
Components: unomi(-core)
Affects Versions: unomi-3.0.0
Reporter: Henrique Santos
h2. Summary
Creating rules with bad payloads doesn't raise errors and causes future errors
on well-formatted requests.
h2. Steps to Reproduce
- Deploy Unomi
- Create a rule through the API with `metadata` but with required fields
missing. For example
{code:bash}
curl --location '/cxs/rules' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic a2FyYWY6a2FyYWY=' \
--data '{
"metadata": {
}
}'
{code}
The request above returns 204.
- Get rules through the API: `GET /cxs/rules`. This returns 500.
- Send an event through the API. For example:
{code:bash}
curl --location '/context.json?sessionId=session-1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic a2FyYWY6a2FyYWY=' \
--data '{
"events": [
{
"eventType": "view",
"target": {
"itemId": "my-website",
"itemType": "page"
}
}
]
}'
{code}
The request above returns 500, despite being correct (if it were sent before
the rule creation, it would be accepted).
h2. Actual Result
The bad request is accepted, and causes future (good) requests to give errors.
h2. Expected Result
The bad request gets rejected with a 4xx error (and a descriptive message of
what went wrong), and doesn't impact future requests.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)