[AC-3152] HTTPClient swallows PUT response
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-06-11T13:56:42.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | http, httpclient, mobilesdk, put, server |
Reporter | Christof Leuenberger |
Assignee | Nikhil Sharma |
Created | 2012-06-08T00:36:39.000+0000 |
Updated | 2016-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');
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.
Out of interest, were you able to get any progress from the 'onsendstream' event and a PUT request/upload? I could not.
I just tried, and I get one callback from the onsendstream event, that logs the following:
marked it as invalid by the reporter thats why closing it
Closing as per Christof's feedback.