5** Http Errors are for the server not client. first you need to sure about your server that works fine. then you have to debug your request with postman.
based on your code that you provided earlier, nothing is wrong. but you must debug your request.