有没有办法从 Postman 响应中检索重定向的 url?没有办法、重定向、Postman、url

由网友(吾儿叛逆伤透我的心)分享简介:我正在尝试在 Postman 中提交一个表单,然后重定向到另一个 url.重定向的 url 查询字符串包含一些我想在下次调用中使用的信息.这甚至可能吗?如果可以,怎么做?I'm trying to submit a form in Postman which then redirects to another url...

我正在尝试在 Postman 中提交一个表单,然后重定向到另一个 url.重定向的 url 查询字符串包含一些我想在下次调用中使用的信息.这甚至可能吗?如果可以,怎么做?

I'm trying to submit a form in Postman which then redirects to another url. The redirected url query string contains some information that I want to use in my next call. Is this even possible and if yes, how?

我无法在 Postman 文档中找到与此相关的任何内容.

I haven't been able to find anything in Postman docs regarding this.

推荐答案

可以,可以检索重定向的URL,提取感兴趣的信息,在Postman的下一个请求中使用.

Yes, you can retrieve the redirected URL, extract interested information, and use it in the next request in Postman.

首先,要检索重定向的 URL,应关闭 Postman 中的自动跟随重定向"选项:

First, to retrieve the redirected URL, the "Automatically follow redirects" option in Postman should be turned off:

然后,你可以拦截重定向响应,提取感兴趣的内容,并将其设置为全局变量或环境变量:

Then, you can intercept the redirect response, extract what is interested, and set it as global variable or environment variable:

最后,这个变量可以用在下一个请求"中,作为 GET 请求中的查询字符串,或者作为 POST 请求正文的一部分:

Finally, this variable can be used in "next request", as query string in GET request, or as part of POST request's body:

阅读全文

相关推荐

最新文章