Request DELETE does not use query string for data #2316

Closed
parnham opened this Issue Feb 28, 2012 · 1 comment

Comments

Projects
None yet
3 participants

parnham commented Feb 28, 2012

When using the Request object for a GET, the data is added to the URL in the form of a query string because GET requests do not have a message body. The same is true of DELETE requests, however the mootools Request object does not add it to the URL but simply leaves the data in the message body which does not then get transmitted/handled by the server.

I propose that this section of the Request send function:

if (data && method == 'get'){
    url += (url.contains('?') ? '&' : '?') + data;
    data = null;
}

be changed to

if (data && ['get', 'delete'].contains(method)){...
Member

sebmarkbage commented Feb 28, 2012

I don't know of any protocol where a DELETE body is valid. Not in WebDav, S3, Azure... I think this should be safe to implement.

arian closed this in 6cad211 Aug 16, 2012

@arian arian added a commit that referenced this issue Aug 16, 2012

@arian arian Merge pull request #2398 from arian/fix-2316-request-delete-body
Fixes #2316 - A DELETE request will use a querystring instead of the request body
34ecf75

@arian arian added a commit to ibolmo/mootools-core that referenced this issue Feb 16, 2014

@arian @ibolmo arian + ibolmo Fixes #2316 - A DELETE request will use a querystring instead of the …
…request body
af4946e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment