有没有办法从 Postman 响应中检索重定向的 url? [英] Is there a way to retrieve the redirected url from a Postman response?

查看:15
本文介绍了有没有办法从 Postman 响应中检索重定向的 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:

这篇关于有没有办法从 Postman 响应中检索重定向的 url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆