【问题标题】:This s a test question for my need of testing the Stack Exchange API这是我需要测试 Stack Exchange API 的测试题
【发布时间】:2023-01-25 02:59:18
【问题描述】:

我正在尝试测试一个函数,该函数接受用户 ID 和标签列表,并返回用户针对带有这些标签的问题发布的所有答案。我正在使用 Stack Exchange API 发出请求并使用 Axios 处理 HTTP 请求。

const axios = require('axios');

异步函数 getAnswersByUser(userId, access_token, key, tags) { 尝试 { const answers = await axios.get(https://api.stackexchange.com/2.2/users/${userId}/answers?order=desc&sort=activity&site=stackoverflow&access_token=${access_token}&filter=withbody&tagged=${tags}&key=${key}); 返回 answers.data.items; } 赶上(错误){ 控制台日志(Error: ${error.message}); } }

【问题讨论】:

    标签: node.js axios


    【解决方案1】:

    这是一个测试答案。我希望这能奏效,这样我就可以删除这个问题并继续我的项目。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多