SOURCE

let sendPost = function(data){
    return axios({
        url: 'http://nodejs-cloud-studio-demo-bkzxs.nodejs-cloud-studio-demo.50185620.cn-hangzhou.fc.devsapp.net/test',
        method: 'post',
        data
    })
}
axios.interceptors.request.use(async function (config) {
    // 通过,config.adapter,允许自定义处理请求
    config.adapter = function (config) {
        return new Promise((resolve) => {
          const res = {
            data: 'hello',
            status: 200,
            statusText: 'OK',
            headers: { 'content-type': 'text/plain; charset=utf-8' },
            config,
            request: {}
          }
          return resolve(res)
        })
    }
    return config
})
;(async function(){
    sendPost({username:'zs', age: 20}).then(res=>{
        console.log('res1',res.data)
    })
    sendPost({username:'zs', age: 20}).then(res=>{
        console.log('res2',res.data)
    })
})();
console 命令行工具 X clear

                    
>
console