nuxt-community / axios-module

Secure and easy axios integration for Nuxt 2
https://axios.nuxtjs.org
MIT License
1.19k stars 245 forks source link

$axios.$delete body payload is missing #419

Closed Bigdragon13th closed 4 years ago

Bigdragon13th commented 4 years ago

@nuxtjs/axios version: 5.12.2

Issue: When trying to call API on delete method, the request body is missing.

Example problematic code:

$axios.$delete('/store/products', {
    data: {
        [
            {
                sku: '1234',
            },
        ],
    },
}

More information: @nuxtjs/axios 5.12.1 don't have this problem

snsxn commented 4 years ago

+1

drocha87 commented 4 years ago

I'm experiencing the same problem, looks like the Content-Type: 'application/json' is removed from headers when sending the request. I tried to intercept the request and set the Content-Type header, but without success.

Bigdragon13th commented 4 years ago

Looks like it's the issue from Axios@0.20.0

https://github.com/axios/axios/issues/3220

ngajhede commented 4 years ago

There is a PR (https://github.com/axios/axios/pull/3282) ready. Question is when 0.20.1 will be released.

A solution we found for now is using axios.request({url, data, method: 'delete'});

avrtau commented 4 years ago

There is a PR (axios/axios#3282) ready. Question is when 0.20.1 will be released.

A solution we found for now is using axios.request({url, data, method: 'delete'});

this.$axios.$request also works.

jasonsaayman commented 4 years ago

Hi,

Axios version 0.21.0 has been released 🎉 please use that and let us know if that solves your issue.

Thanks

suruaku commented 4 years ago

Axios version 0.21.0 has been released tada please use that and let us know if that solves your issue.

The issue is solved in 0.21.0

I made merge request with pkg update #436

Bigdragon13th commented 4 years ago

@jasonsaayman I've tested Axios 0.21.0 and it fixed the issue, thank you. But install @nuxtjs/axios 5.12.2 without Axios still give me Axios 0.20.0, so maybe we need to wait for @suruaku 's PR before closing this issue.

suruaku commented 4 years ago

But install @nuxtjs/axios 5.12.2 without Axios still give me Axios 0.20.0, so maybe we need to wait for @suruaku 's PR before closing this issue.

It is because how semver works. See this post or straight from documentation

Bigdragon13th commented 4 years ago

@suruaku Yeah, I get that

danielalvarenga commented 4 years ago

But install @nuxtjs/axios 5.12.2 without Axios still give me Axios 0.20.0, so maybe we need to wait for @suruaku 's PR before closing this issue.

It is because how semver works. See this post or straight from documentation

Wainting for that! :raised_hands:

pi0 commented 4 years ago

Merged by #410 and updated with v5.12.3. Sorry for delay.