easyXDM PUT将数据放在查询字符串中



嗨,我有一个非常奇怪的问题,当尝试使用easyXDM PUT请求。

that.xhr.request({
                        url: url,
                        method: "PUT",
                        data: [{"foo":"test"}],
                        headers: { "Content-Type": "application/json;" }
                    }, function (response, xhr) {
                        options.success(jQuery.parseJSON(response.data));
                    },function(err) {
                        alert(err);
                    });

这不会生成请求体消息,而是将数据视为查询字符串参数。在这方面有什么可以做的吗?非常感谢

我刚刚遇到了同样的问题,并以以下方式解决了它:

如果在远程站点上使用easyXDM附带的默认index.html,则有一行表示

var isPOST = (config.method == "POST");

替换这一行
var isPOST = (config.method == "POST") || (config.method == "PUT");

和数据应该作为表单数据发送,而不是查询字符串参数。

最新更新