Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix axios config headers #5166

Closed
wants to merge 2 commits into from
Closed

fix axios config headers #5166

wants to merge 2 commits into from

Conversation

Christopher-md
Copy link

Hi, I faced this problem in version 1.0+

After refreshing the token, I was returning a request with the old configurations. When I looked in the network, after updating the token, the getUserInfo method was not displayed.

Solution: need to check if config.headers is not instance of AxiosHeaders

 if (!(config.headers instanceof AxiosHeaders)) {
      const defaultHeaders = config.headers && utils.merge(
          config.headers.common,
          config.headers[config.method]
      );

      defaultHeaders && utils.forEach(
          ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
          function cleanHeaderConfig(method) {
            delete config.headers[method];
          }
      );

      config.headers = new AxiosHeaders(config.headers, defaultHeaders);
    }

Hope you fix it soon. Thanks

Чайковский Кристиан Андреевич and others added 2 commits October 20, 2022 16:27
@Christopher-md
Copy link
Author

Has been fixed in #5224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant