'Axios rewrites Authorization header

I am new in vuejs. Developing on Laravel8 + Vuejs3. I have following code in vue:

methods: {
   getUsersList(url=null){
            let request_headers = {}
            request_headers['Accept'] = 'application/json'
            if(this.$store.state.token !== null) {
                request_headers['Authorization'] = 'Bearer ' + ' ' + this.$store.state.token
            }
            if(url == null) {
                url = this.API_URL + '/user/list'
            }
            axios
            .get(url, {headers: request_headers})
            .then(response => {
                if(response.data.result){
                    this.headers = response.data.data.headers;
                    this.body = response.data.data.body;
                }
            })}

console.log(request_headers['Authorization']) shows right token, but in request headers axios sends another token(all the time the same)

I don't know why. Please help. I tried a few solution like: creating new axios instance and adding default header manually

Helpless.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source