DialogFlow外部api调用-结果始终是对象Object [duplicate]

问题描述 投票:0回答:1

下面是index.js中的方法

function costOfItemHandler(agent) {
    const itemName = agent.parameters.foodItem;
    const url = "https://fast-beach-13460.herokuapp.com/Eatery";
    return axios.get(url)
        .then((result) => {
            console.log('result is '+ result);   
        });

在日志中,即将到来的textPayload:“结果是[object Object]”。当我浏览网址时,它会给出正确的响应。

javascript node.js firebase dialogflow dialogflow-fulfillment
1个回答
0
投票

尝试一下:

console.log('result is ', result);

如果将对象附加到字符串,它将返回[对象,对象]。

© www.soinside.com 2019 - 2024. All rights reserved.