Google App Engine seems to confuse Android Post with Get over HTTPClient

You must Login before you can answer or comment on any questions.

This is odd. It's only happening with Android platforms. iOS uses the same code and is recognized correctly as a Post. Running with Android 2.3.3 SDK, compiled for API 10 on Titanium 3.0.0.GA.

The code is textbook from the examples in the documentation. This below obviously isn't my code, but all the elements are the same. The request method for Android is always read as a GET on GAE. iOS request methods are acknowledged as POST with this code.

var my_xhr = Titanium.Network.createHTTPClient();
 
my_xhr.open('POST','http://website.com/mobileupdate/');
 
etc..
etc..
 
my_xhr.setRequestHeader('Content-Type', 'text/json; charset=utf-8');
my_xhr.send({
  'master_stack': JSON.stringify(object_type_variable),
});
I've seen a number of similar posts in Q&A -- all with conflicting (bad) advice. Anyone familiar with this issue?

— asked 1 year ago by Francis Meetze
3 Comments
  • Are you getting a 302/redirect in between? My guess is that you are issuing a POST and then getting a 302 which is followed by a GET. Run a trace and confirm. If so I will post the answer.

    — commented 1 year ago by David Bankier

  • Thanks Dave. No, the status is 200. See the GAE printout in the answer below. I understand this is an error that's been filed in Jira: https://jira.appcelerator.org/browse/TC-1521

    — commented 1 year ago by Francis Meetze

  • Hi David, you peaked my curiosity. I tried to search for some references on the 302/redirect and didn't come up with anything. I'm still interested in your answer. :)

    — commented 1 year ago by Francis Meetze

1 Answer

Try android 4.2 if the problem persists inform us.

— answered 1 year ago by Michael Massalas
answer permalink
1 Comment
  • Great suggestion! I needed to do that anyhow. Unfortunately, I have the same sob story with 4.2. Here's GAE's log:

    2012-12-21 11:49:19.870 /mobileupdate/masterstack/ 200 62ms 0kb
     
        68.113.13.73 - - [21/Dec/2012:11:49:19 -0800] "GET /mobileupdate/masterstack/ HTTP/1.1" 200 34 - - "www.my_website.com" ms=62 cpu_ms=43 cpm_usd=0.000004 instance=00c61b117c875688bee715982d2ec4e0059e41
     
        W 2012-12-21 11:49:19.867
     
        request method: GET

    — commented 1 year ago by Francis Meetze

Your Answer

Think you can help? Login to answer this question!