履行Dialogflow上的POST HTTP请求无法正常工作

时间:2019-08-24 02:04:03

标签: http request dialogflow fulfillment

经过多次尝试,我无法在内联编辑器中执行HTTP请求

const axios = require('axios');
function distance(agent){
    const city1 = agent.parameters['geo-city'];
    const city2 = agent.parameters['geo-city1'];
    var response = "";
    axios.post('https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins='+ city1 +'&destinations='+ city2 +'&key=KEY', {})
    .then(res => {
      const json = JSON.parse(res);
        response = json.rows[0].elements[0].distance.text;
    })
    .catch(error => {

    });
    agent.add(response);
}

这不返回任何响应为什么?

0 个答案:

没有答案