Error: request failed with status code 500

in projects where the front and back ends are separated

the front end USES a post request to send data to the back end, but an error occurs:

Error: Request failed with status code 500 Error

we need to know that 500 represents (server internal error) the server encountered an error and was unable to complete the request.

take a look at my original part of the code:

front-end request:

back-end receiving entity and control layer code:

if you look closely, you will see that the parameter names that my front end took when I sent the request were userName and password

but the back end used username and password to receive the parameters from the front end, so I changed the front end username — > username

finally OK! If you have the same problem, check to see if the parameters you sent are the same as the parameters you received, otherwise the parameters will be empty

Read More: