Coder Social home page Coder Social logo

Comments (6)

zjxxxxxxxxx avatar zjxxxxxxxxx commented on May 26, 2024

common 字段已经被默认配置占用了,这里的实现和 axios 是一致的。

全局设置可以

axios.defaults.headers.common['common'] = '你的属性';

// 或者给方法设置

axios.defaults.headers.get['common'] = '你的属性';
axios.defaults.headers.post['common'] = '你的属性';

局部设置可以

axios.get(
  'url',
  {},
  {
    headers: {
      get: {
        common: '你的属性',
      },
    },
  },
);

axios.post(
  'url',
  {},
  {
    headers: {
      post: {
        common: '你的属性',
      },
    },
  },
);

建议在条件允许的情况下,优先考虑换个其他的名称。

from axios-miniprogram.

changweihua avatar changweihua commented on May 26, 2024

微信图片_20230423135628

我在拦截器中,增加header值,2.3.0中 request header 中是包含这些值的,但是在2.3.1中,request header 里面没有这些值,我看了下代码,感觉这里有点奇怪。没明白为啥要delete config.headers。

感谢。

from axios-miniprogram.

zjxxxxxxxxx avatar zjxxxxxxxxx commented on May 26, 2024

意思是说红框中的设置在 2.3.1 中丢失了吗?

from axios-miniprogram.

changweihua avatar changweihua commented on May 26, 2024

是的

from axios-miniprogram.

zjxxxxxxxxx avatar zjxxxxxxxxx commented on May 26, 2024

2.3.2 已经修复

from axios-miniprogram.

changweihua avatar changweihua commented on May 26, 2024

已测试,OK了,感谢。

from axios-miniprogram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.