I am getting 500 "Internal Server error" form ionic Post API Call, the api is working fine with postman. I try with jquery ajax call as well inside ionic it is giving the success response, this is the post call I am making since I am new to ionic so I am not getting where the problem exist weather its related to data or header and while making jquery I didn't use any header.
this.http.post("https://test/user/getdata", JSON.stringify({
"username": "abcd",
"country": "in",
"token": "asjsjhaakjdhkjhhkjggjhggh"
},{
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
}
);
this call is giving me internal server error and If I change my header to 'application/json' I am getting "Access to XMLHttpRequest at 'https://test/abc' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status." this error I have tried with putting these headers also **
- (" access-control-allow-methods", 'GET, POST'),
- ("access-control-allow-origin", "*"),
- ("Access-Control-Allow-Credentials", 'true');
** but nothing worked. any help would be appreciable thanks in advance.