wymsee / cordova-HTTP

Cordova / Phonegap plugin for communicating with HTTP servers. Allows for SSL pinning!
MIT License
372 stars 301 forks source link

Data pushed into error callback, though response status code is 200 #112

Closed keerthivasan-r closed 7 years ago

keerthivasan-r commented 7 years ago

I'm making a HTTP GET request to server side component, which will respond with data in json format

 loadMenuData: function(branchid) {
         if (device.platform == 'iOS') {
             return cordovaHTTP.get(Config.url + "menuProvider/getMobileMenuList", {
                 'storeid': Config.storeid,
                 'apitoken': Config.apitoken,
                 'branchid': branchid
             }, {
                 'Accept': "application/x-javascript"
             });
         }

It returns a promise. In promise.then(successCallback,failureCallback) The data gets pushed to failureCallback. I couldn't witness the XHR call in the safari browser inspect tool as well. The status code is yet 200. This is very weird to me. Can someone help me understand what may be happening?

keerthivasan-r commented 7 years ago

Guys, this was the problem with server side program that was sending back with JSONP enabled with callback parameter. Now, i have changed to just respond with "application/json", it perfectly works fine! I am currently implementing the server side communication with this plugin thinking that Apple will approve my app. Let's see how this goes.