有时我需要测试多次重定向单个请求的网站。作为一个简单的例子,我用 PHP 创建了一个示例脚本:
<?php
$n = (int) $_GET['n'] ?? 0;
if ($n < 9) header('Location: ?n=' . ($n + 1));
else echo $n;
I found out that Postman (by default?) allows up to 9 (see the EDIT below) 10 redirects and crashes on 10th 11th. When I test that script in Postman, it shows the response of 9
, which is expected. What it's missing is the entire redirection chain, which I sometimes need to examine.
我知道有自动遵循重定向选项,但它根本不遵循重定向。
是否可以查看请求经过的所有 URL?就我而言,那就是:
http://foo.test/
http://foo.test/?n=1
http://foo.test/?n=2
...
http://foo.test/?n=8
http://foo.test/?n=9
EDIT
结果我的重定向来自一个/directory
to /directory/
,因此实际可能的重定向数量为 +1。
是的,您可以使用邮递员控制台查看所有网址。
见左下角红框。单击它即可访问控制台。
希望能帮助到你 :)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)