title: IONIC Getting 500 "Internal Server error" form Post API Call
body: <p>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.</p>
  
  <pre><code>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')
     }
  );
  </code></pre>
  
  <p>this call is giving me internal server error and If I change my header to <strong>'application/json'</strong> I am getting
  <strong>"Access to XMLHttpRequest at '<a href="https://test/abc" rel="nofollow noreferrer">https://test/abc</a>' from origin '<a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a>' has 
  been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status."</strong>
  this error I have tried with putting these headers also
   **</p>
  
  <ol>
  <li>(" access-control-allow-methods", 'GET, POST'), </li>
  <li>("access-control-allow-origin", "*"), </li>
  <li>("Access-Control-Allow-Credentials", 'true');</li>
  </ol>
  
  <p>**
   but nothing worked. any help would be appreciable thanks in advance.</p>