axios没有得到回应

时间:2020-07-14 19:56:03

标签: node.js web axios

const getReq = async () => {
    try {
        const res = await axios.get('https://www.peoplestuffuk.com/WFMMCDPRD/LoginSubmit.jsp?txtUserID={user}&txtPassword={password}')
        console.log(res)
    } catch (e) {
        console.log(e.message)
    }
}

我收到“请求失败,状态码为500”,但收到了操纵up和邮递员的响应。我无法解决这个问题!是因为网站很大还是速度太慢。任何帮助将不胜感激demo on postman

1 个答案:

答案 0 :(得分:0)

尝试更换您的

const res =等待axios.get('https://www.peoplestuffuk.com/WFMMCDPRD/LoginSubmit.jsp?txtUserID= {user}&txtPassword = {password}')

使用

const res = await axios.get(`https://www.peoplestuffuk.com/WFMMCDPRD/LoginSubmit.jsp?txtUserID=${user}&txtPassword=${password}`)

好像您要将变量作为字符串的一部分传递