Sunagatov / Iced-Latte

a online Marketplace for coffee retail (Backend)
https://iced-latte.uk
MIT License
587 stars 95 forks source link

System allows save review with text that = whitespaces. #310

Open TetianaPerinha opened 3 weeks ago

TetianaPerinha commented 3 weeks ago

Describe the bug When sending a POST review request with text =whitespaces, the system allows it to save.

Precondition: User is registered, the Bearer token is obtained, and the user has not posted a review on a product.

To Reproduce Send the POST request as below, and use a valid Bearer token.

curl --location 'https://iced-latte.uk/backend/api/v1/products/ba5f15c4-1f72-4b97-b9cf-4437e5c6c2fa/reviews' \ --header 'Content-Type: application/json' \ --header 'Authorization: {token}' \ --data '{ "text": " ", "rating": "5"

}' Expected behavior The system should reject request with 400 HTTP Status code and return the appropriate error message = "Invalid data".

Actual result System accept the request, HTTP Status code = 200 and review posted with text = " "

alows save review with whitespace
RaffhanKhan commented 3 weeks ago

@TetianaPerinha / @Sunagatov I have fixed the bug please validate and approve.