【问题标题】:Postman request with 'global' URL带有“全局”URL 的邮递员请求
【发布时间】:2019-04-16 11:57:38
【问题描述】:

我想知道是否可以为 Postman 中的所有请求 URL 添加“前缀”?

通常一个请求是这样的:

HERE

http://localhost:8000/test

但我只想说:

/test

并把http://localhost:8000 像一个全局URL。

我问这个是因为我从本地到服务器交换了很多相同的 URL,我只想更改一个 URL 而不是所有请求的 URL。

【问题讨论】:

    标签: url request postman


    【解决方案1】:

    您是否考虑过使用environment 文件?

    https://www.getpostman.com/docs/v6/postman/environments_and_globals/manage_environments

    添加一个名为url 的变量,其值为http://localhost:8000。然后,您可以在 URL 中使用此值,例如 {{url}}

    如果您的请求的构造类似于{{url}}/test - 您可以使用每个环境中不同的url 变量创建任意数量的环境。因此,通过更改environment,这会将您的请求指向本地、登台或生产服务器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      • 2017-06-17
      • 2020-05-22
      • 2018-03-09
      • 2018-01-19
      • 2021-08-28
      相关资源
      最近更新 更多