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

possible bug in setHeader function #505

Closed Fox155 closed 3 years ago

Fox155 commented 3 years ago

Good afternoon, when I want to delete the token in the following way

this.$axios.setToken(false, 'Bearer', [ 'get', 'post', 'delete', 'put', 'patch', ])

I noticed that it was not being completely deleted, and after a little digging I came to the conclusion that the setHeader function is returning before going through all the scope.

https://github.com/nuxt-community/axios-module/blob/a9e4867587cd60a25aca441159938495d41755c9/lib/plugin.js#L10-L18

I propose to change that return for a continue, because otherwise only the first element of the scope is deleted.

Greetings.

pi0 commented 3 years ago

Thanks for notice @Fox155. PR welcome for fix.

pi0 commented 3 years ago

Thanks! https://github.com/nuxt-community/axios-module/releases/tag/v5.13.6