forked from sphinix27/notifier_api_test
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Description
When we send a notification with a container with more than 256 characters it returns a response of status code 500
Environment
- An Notifier Server installed with version 1.0
- Operating System and version:
Windows Server 2012 R2
Requirements
- Rest Client: E.g. Postman.
- Channel already created and retrieve id: E.g. 353
API
- Method:
POST - Endpoint:
/api/notifications
Steps to Reproduce
- Open Postman.
- In Postman select 'POST' method for URL.
- In Postman Enter the endpoint to send a notification.. E.g. http://128.0.0.1/api/notifications/
- In Postman select Body tab. A Key - Value appears.
- In Postman under Body tab select the radio button with the 'raw' option.
- In Postman under Body tab press the drop down list button that says 'Text' and select the 'JSON(application/json)' option.
- In Postman in text area field write the body for send a notification. E.g.
{ "channelId" : 353,
"priority" : "NORMAL",
"recipients" : ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],
"subject" : "Test",
"content" : "A testing message from notifier"
}- Click on Send button. Receive a json response similar to this e.g.
{
"timestamp": 1507677416263,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.dao.DataIntegrityViolationException",
"message": "Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement",
"path": "/notifications/"
}- Verify that a status code 500 is returned
Actual Result
We receive a response with status code 500 "Internal Server Error"
Expected Result
You should return the following response.
{
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.web.bind.MethodArgumentNotValidException",
"errors": [
{
"field": "recipients",
"code": "Size",
"defaultMessage": "size must be between 1 and 22"
}
],
"message": "Bad Request",
"path": "/notifications"
}Note: This case is for recipients in slack handles ranges from 1 to 22 characters.
Reactions are currently unavailable