How to Solve Error: Request failed with status code 500

The front and back ends are separated in the project

The front end uses post request to send data to the back end, but there is an error:

Error: request failed with status code 500

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 part of my original code:

Front end request:

Back end receiving entity and control layer code:

At this time, if you look carefully, you will find that the name of the parameter that my front-end carries when sending the request is   userName   and   password
However, the backend uses the user name when receiving the front-end parameters   and   Password, so I changed it   Front end   userName——> username


Finally OK!   If you also have this problem, you can check whether the parameters you send are consistent with those you receive, otherwise the parameters will be empty
</ div>

Similar Posts: