Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3152] HTTPClient swallows PUT response

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2012-06-11T13:56:42.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelshttp, httpclient, mobilesdk, put, server
ReporterChristof Leuenberger
AssigneeNikhil Sharma
Created2012-06-08T00:36:39.000+0000
Updated2016-03-08T07:48:13.000+0000

Description

It seems that any form of response from a PUT request is being swallowed by the Titanium.Network.HTTPClient. I know that PUT requests shouldn't necessarily send a response, but I don't see the point in it being omitted. I have tried sending the response both directly, but also sending a Location header back to the HTTPClient after the PUT and dumping the response at the redirected location. The onload callback of the request object has the responseText property missing in both cases:
{"source":{"cache":false},"type":"load"}
Steps to reproduce: - Write a serverside script that will accept a PUT request and send some kind of response (JSON in my case) - Send a request:
var client = Ti.Network.createHTTPClient({
  onload: function(e)
    {
    Ti.API.info(e);
    },
  onerror: function(e)
    {
    Ti.API.error(e);
    }
  });
client.open('PUT', 'http://server/resource/location');
client.send('property=value');

Comments

  1. Christof Leuenberger 2012-06-08

    I'm sorry, this seems to work. It looks like the problem was that my onload handler was being overridden by another request, in combination with the response object being logged without the responseText attribute (that might the bug?). Please close.
  2. kosso 2012-06-10

    Out of interest, were you able to get any progress from the 'onsendstream' event and a PUT request/upload? I could not.
  3. Christof Leuenberger 2012-06-10

    I just tried, and I get one callback from the onsendstream event, that logs the following:
       {"source":{"cache":false},"type":"sendstream","progress":1}
       
  4. Nikhil Sharma 2012-06-11

    marked it as invalid by the reporter thats why closing it
  5. Shak Hossain 2013-12-27

    Closing as per Christof's feedback.

JSON Source