emirkljucanin
emirkljucanin

Reputation: 814

easyXDM PUT places data in query string

Hi I have a very strange problem when trying to make PUT request using easyXDM.

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);
                    });

This does not generate request body message, instead it treats data as query string parameter. Is there anything that can be done regarding this? Thnx

Upvotes: 2

Views: 407

Answers (1)

suamikim
suamikim

Reputation: 5319

I just ran into the same problem and solved it the following way:

If you use the default index.html that is shipped with easyXDM on the remote site there is a line that says

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

Replace this line with

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

and the data should be sent as form data instead of query string parameters.

Upvotes: 2

Related Questions