我有一个在 NekoVM 下运行的服务器,它提供 RESTLike 服务。我正在尝试使用以下 Haxe 代码向该服务器发送 PUT/DELETE 请求:
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" );
}
问题是只有onStatus
事件显示一些东西:
Main.hx:32: 200
Main.hx:33: onStatus
Main.hx:34: { b => { b => #abstract } }
谁能解释我做错了customRequest
什么?