分配给axios响应数据的变量中断了应用程序

时间:2019-09-03 11:49:23

标签: javascript reactjs react-native axios

我有以下代码:

 const config = { headers: { "Content-Type": "application/json" } };

 const data = JSON.stringify({ postId });

 console.log('sending request'); // prints

 const response = await axios.post(
 `http://${GATEWAY}:5000/api/posts/single`,
 data,
 config
 );

 console.log("response received"); // never reached

但是当我改变

 const response = await axios.post(...

 const res = await axios.post(...

或与此相关的任何其他字词,response received都会被打印,并且该应用不会崩溃。有人对此有见识吗?内存泄漏?

0 个答案:

没有答案