I have a server running under NekoVM which provide a RESTLike service. I am trying to send a PUT/DELETE request to this server using the following Haxe code :
static public function main()
{
var req : Http = new Http("http://localhost:2000/add/2/3");
var bytesOutput = new haxe.io.BytesOutput();
req.onData = function (data)
{
trace(data);
trace("onData");
}
req.onError = function (err)
{
trace(err);
trace("onError");
}
req.onStatus = function(status)
{
trace(status);
trace("onStatus");
trace (bytesOutput);
}
//req.request(true); // For GET and POST method
req.customRequest( true, bytesOutput , "PUT" );
}
The problem is that only the onStatus
event is showing something :
Main.hx:32: 200
Main.hx:33: onStatus
Main.hx:34: { b => { b => #abstract } }
Can anyone explain me what I am doing wrong with customRequest
?
customRequest
does not call onData
.
After customRequest
call is finished either onError
was called or first onStatus
was called, then response was written to specified output.