actionscript-3 - AS3 POST 请求作为 GET 发送

标签 actionscript-3 http

当尝试向 ASP.NET asmx Web 服务发送 POST 请求时,我看到(在 Charles 和 Firebug 中)它以 GET 方式通过。

这是我的 AS3

public function save(page:SharedPageVO, callback :Function = null): void {
   var req:URLRequest = new URLRequest( "service.asmx/CreateSharedPage" );
   req.data = page;
   req.method = URLRequestMethod.POST;
   if (callback != null)
   {
    //handle removing the event here instead of there
    this.complete = callback;
    DataService.instance.addEventListener(Event.COMPLETE, onComplete);
   }
   DataService.instance.load( req );
}

public var complete:Function;
private function onComplete(e:Event)
{
 if (complete != null) complete(e);
 complete = null;
 DataService.instance.removeEventListener(onComplete);
}

这似乎是闪存的问题,因为它甚至在进入服务器之前就已经发生了。我已将其上传到测试服务器,但我仍然看到它以 GET 方式通过。任何帮助,将不胜感激。谢谢。

最佳答案

来自 actionscript LR(URLRequest 类,方法属性):

注意:如果在 Flash Player 中运行并且引用的表单没有主体,Flash Player 会自动使用 GET 操作,即使该方法设置为 URLRequestMethod.POST。因此,建议始终包含“虚拟”主体以确保使用正确的方法。

你在使用那个“虚拟” body 吗?

关于actionscript-3 - AS3 POST 请求作为 GET 发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3557264/

相关文章:

unit-testing - 使用模板 golang 进行单元测试

http - 如何使用 wreq 发送 PUT 请求?

performance - Actionscript 3 绘制大矩形导致 FPS 大幅下降

c++ - 从 C++ 到 AS3 : what are fundamental AS3 data structures classes?

android - 使用 Retrofit2 的补丁请求无法在 Android 上运行

http - Content-Type : image? 的可靠性

android - 通过改造从服务器接收 PDF 响应

flash - 是否有仅适用于 Flash(而非 Flex)的[嵌入]替代方案?

actionscript-3 - 来自 AS3 的 SOAP Web 服务,没有 Flex?

flash - AS3 - 未定义属性的访问(静态变量)