【问题标题】:how to watch the http requested data using postman如何使用邮递员查看http请求的数据
【发布时间】:2021-08-26 07:48:28
【问题描述】:

我通过发出以下http请求获得了数据,目前我正在做console.log(),但是如何在邮递员中查看数据。

function getProducts() {
  http
    .get(url, (res) => {
      let body = "";
      res.on("data", (chunk) => {
        body += chunk;
      });
      res.on("end", () => {
        try {
          let json = JSON.parse(body);
          console.log(json);
        } catch (error) {
          console.error(error.message);
        }
      });
    })
    .on("error", (error) => {
      console.error(error.message);
    });
} 

【问题讨论】:

    标签: node.js json http postman


    【解决方案1】:

    http.get() 与 Postman 完全一样。

    如果您想要 Postman 中的数据,只需在其中调用 url

    【讨论】:

      【解决方案2】:

      我不确定我是否理解正确,但这就是我能说的

      1. here下载并安装邮递员
      2. UI 很简单,像浏览器一样有标签,创建一个新标签(请求)
      3. 默认 http 方法是 Get,因此您无需更改它。输入您的 URL 点击发送按钮。
      4. 您可以添加标头等...

      【讨论】:

        猜你喜欢
        • 2020-07-30
        • 2018-09-29
        • 1970-01-01
        • 1970-01-01
        • 2016-02-20
        • 1970-01-01
        • 2017-06-17
        • 2021-03-28
        • 2021-12-14
        相关资源
        最近更新 更多