AS3 POST Request sending as a GET

2019-08-01 08:24发布

When trying to send a POST request to an ASP.NET asmx web service I am seeing (in Charles and Firebug) it go through as a GET.

Here is my 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);
}

This seems to be an issue with flash as it is happening before it even goes to the server. I have uploaded this to a testing server and I still see it come through as a GET. Any help would be appreciated. Thanks.

1条回答
Lonely孤独者°
2楼-- · 2019-08-01 08:57

From actionscript LR (URLRequest class, method property):

Note: If running in Flash Player and the referenced form has no body, Flash Player automatically uses a GET operation, even if the method is set to URLRequestMethod.POST. For this reason, it is recommended to always include a "dummy" body to ensure that the correct method is used.

Are you using that "dummy" body?

查看更多
登录 后发表回答