我想开玩笑地测试 axios 请求。问题是我已经搜索了很多方法,但没有理解其中的一堆,我被困住了。例如这里是我获取请求
componentDidMount() {
const { getAll, setPageCount } = this.props.actions;
axios
.get(`http://localhost:8080/${localStorage.getItem("username")}`, {
headers: {
"auth-token": localStorage.getItem("auth-token"),
},
})
.then((res) => {
getAll(res.data);
setPageCount();
})
.catch((err) => {
console.log("-----token", localStorage.getItem("auth-token"));
console.log("err", err);
});
}
我怎样才能开玩笑地测试?提前致谢