10

I have the following method in my Vue.JS component:

removeItems (itemsArray) {
    this.$http.delete(this.apiUrl, {items : itemsArray})
    .then((response) => {
       this.msg = response.msg;
    });
}

In vue-resource 0.8.0 everything worked fine. After upgrading to 1.0.3 it doesn't. I found in release notes that they deleted body from GET request, which makes sense, but why did the DELETE request stop working? If they disabled specifying body explicitly in the DELETE request, how do I add it?

ierdna
  • 5,753
  • 7
  • 50
  • 84

1 Answers1

12

Found a solution. Simply add {body:data} to the request:

removeItems (itemsArray) {
  this.$http.delete(this.apiUrl, {body: {items : itemsArray}})
  .then((response) => {
    this.msg = response.msg;
  });
}
ierdna
  • 5,753
  • 7
  • 50
  • 84