gpt4 book ai didi

actionscript-3 - URLRequest/URLLoader 自动将 POST 请求转换为 GET

转载 作者:可可西里 更新时间:2023-11-01 15:20:07 24 4
gpt4 key购买 nike

当我执行以下代码时:

var urlRequest:URLRequest = new URLRequest("http://somehost/with/some/path?andsomequerystring=true");
urlRequest.method = 'POST';
var urlLoader:URLLoader = new URLLoader(urlRequest);
urlLoader.addEventListener(Event.COMPLETE, function(event:Event):void{
trace('sweet');
});

由于查询字符串的存在,它将我的显式 POST 请求转换为 GET。如果我删除查询字符串(并序列化为 POST 正文的一部分),它会成功发出相应的 POST 请求。有什么办法可以防止它这样做吗?我的服务器要求使用查询字符串发出 POST 请求。

最佳答案

啊,我想我找到了答案,看来你还必须指定一个正文,否则它仍会作为 GET 请求从他们的文档中发送:

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.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#url

关于actionscript-3 - URLRequest/URLLoader 自动将 POST 请求转换为 GET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12774611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com