ita-social-projects/WhatBackend

API_'Courses'_Status Code 422 appears after sending PUT request with invalid ID instead of Status Code 400

Closed this issue · 0 comments

Environment: Windows 10 (x64), Google Chrome Version: 100.0.4896.127
Reproducible: always
Build found: last commit from https://github.com/ita-social-projects/WhatBackend

Pre-conditions:
@user: Administrator or Secretary

  1. @user is logged in system: https://whatbackendapi.azurewebsites.net/index.html?urls.primaryName=WHAT%20Project%20API%20v2;
  2. Course with 'Soft Skills for Lecturers' exists in system.

Steps to reproduce:

  1. Fiel 'id' field with data '7';
  2. Fiel 'name' field with data 'Soft Skills for Lecturers';
  3. Make PUT request to REST endpoint: https://whatbackendapi.azurewebsites.net/index.html?urls.primaryName=WHAT%20Project%20API%20v2

Actual result:

Status Code 422 (Error: Unprocessable Entity)
Body response content:
{
"error": {
"code": 4,
"message": "Сourse name "Soft Skills for Lecturers"is already taken"
}
}

Expected result:

Status Code 409 (Error: Course already exist)
Body response content:
{
"error": {
"code": 4,
"message": "Сourse name "Soft Skills for Lecturers"is already exist"
}
}
'Bug', Priority ('Medium'), Severity ('Major'), Type ('Functional')

Attachment:
**
https://user-images.githubusercontent.com/96871016/165847556-2ddbe658-5295-42d5-84d8-317ec34c7dcc.mp4
**
'Bug', Priority ('Medium'), Severity ('Major'), Type ('Functional')