nodejs 服务端发送429状态:

    extendInfo (req, res) {
       res.status(429).json('Too many requests, please try again later.')  
    },

 

vue客服端

export const ajaxPost=(url, params) => {
    return axios.post(ajaxIp+url, params, {
        headers: {
            // "Content-Type": "multipart/form-data"
            "Content-Type": "application/json"
        }
    }).then(res=>{
        if (data.code == 200) {
            return data.data;
        }else {
            return {code:data.code,msg:data.msg}
        }
    })
        .catch(err => {  //捕获异常状态码
            console.error(err.response.status);
        });
}

 

相关文章:

  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
猜你喜欢
  • 2021-06-01
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-12-31
  • 2021-09-11
  • 2021-05-09
相关资源
相似解决方案