Ionic 2 http.post 500 internal error on ionic view app


#1

Hi There,

Have anyone encounter issue with http.post to work perfectly fine on local browser i.e. ionic serve, However, the same code block returned 500 internal server error while running on ionic view app.

  let headers = new Headers();
  headers.append('Authorization', 'Client-ID xxxxxxxxxxxxxxx');
  headers.append('Content-Type', 'application/json');
  let options = new RequestOptions({ headers: headers });

  let postParams = JSON.stringify({
    image: base64Image,
    type: 'base64'
  });

  this.http.post('https://api.imgur.com/3/image', postParams, options)
    .map(res => res.json())
    .subscribe(result => {
      this.myStatus += "Sucess: OK";
    }, error => {
      this.myStatus += "Error: " + error;
    });

Thanks,
dc


#2

same error 500 internal server error is there any solution for this


#3

You can use ADB PlugIn in Chrome to debug that error and give us more information


#4

There has to be a reason your server returns Error 500. Find out what it is.
If you don’t control the server, look into the request the app is sending. Use something like Charles Web Proxy to debug the request.


#5

If you fetching data using rest api, so one reason is you have to increase the memory limit, in wp_admin.php file, I have solved my issues 500 internal…like:
1)Go to wp_admin.php file on your word-press server
2 Find the following line near the end of the file:
/* That’s all, stop editing! Happy blogging. */
3)Just above that line, add the following line:
define(‘WP_MEMORY_LIMIT’, ‘64M’);