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

查看:92
本文介绍了有没有办法从邮递员响应中检索重定向的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用邮递员提交一个表单,然后将其重定向到另一个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?

我在邮递员文档中找不到与此相关的任何内容。

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

推荐答案

是的,您可以检索重定向的URL,提取感兴趣的信息,并在邮递员的下一个请求中使用它。

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请求中的ery字符串,或作为POST请求正文的一部分:

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

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

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