go-macaron/macaron

Method DELETE unable to get the parameters

evildecay opened this issue · 1 comments

// web ajax 1
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://127.0.0.1:8088/showform",
  "method": "DELETE",
  "headers": {
    "content-type": "application/x-www-form-urlencoded",
    "cache-control": "no-cache"
  },
  "data": {
    "foo": "bar"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
// web ajax 2
var form = new FormData();
form.append("foo", "bar");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://127.0.0.1:8088/showform",
  "method": "DELETE",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
// web server
log.Println("query:", ctx.Query("foo"))
// Get empty

DELETE not support?

http://127.0.0.1:8088/showform?foo=bar
It work.

Hi, I think by default JS sends JSON not form-encoded type (which you're trying to get).