1
我有这样的功能:是否可以将一个主体有效载荷提供给DELETE请求?
async deleteBuilding ({ commit, state }, payload) {
const urlEnd = '/v1/building/update'
const type = 'delete'
const resp = await api.asyncRequest(urlEnd, type, payload)
commit('DELETE_BUILDING', resp.data)
return resp
},
api.asyncRequest = async (urlEnd, type, payload = {}) => {
return await Vue.http[type](api.serverUrl + urlEnd, payload, timeout)
}
正如你所看到的,我喂有效载荷删除请求(即我想删除建筑物的ID)。但是,有效负载永远不会满足请求。
这是DELETE的正常行为吗?如果是这样,如何将有效载荷添加到DELETE请求?
你检查了别人的问题吗? http://stackoverflow.com/questions/299628/is-an-entity-body-allowed-for-an-http-delete-request – andrusieczko