There is the following code:
params =
method: 'DELETE'
url: "profiles/#{@currentProfile.id}/boxes/#{@box.id}/messages"
data:
ids: ids
headers:
"Content-Type": "application/json;charset=utf-8"
$http(params)
When I execute this DELETE request I see that this request has no body, ie my request has no "ids" param in the body. How can I fix it? I saw some answer on StackOverflow, where people gave advice to set 'Content-Type' header. I did it, but it didn't help me.
I have tested your configuration ( codepen ). You can see in the dev tools that the request body is sent fine:
params =
method: 'DELETE'
url: "someurl"
data:
ids: [1,2,3]
something: 'anything'
headers:
"Content-Type": "application/json;charset=utf-8"
$http(params)
Keep in mind that some backends will ignore the DELETE body by default. Try to redesign you API.
Have a look at:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.