How to view the redirection chain in Postman?

Viewed 1966

Sometimes I need to test websites that redirect single request multiple times. As a simple example, I created a sample script in 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.

I know there's the Automatically follow redirects option, but it just doesn't follow redirections at all.

Is it possible to see all URLs that the request goes through? In my case that would be:

http://foo.test/
http://foo.test/?n=1
http://foo.test/?n=2
...
http://foo.test/?n=8
http://foo.test/?n=9

EDIT

It turned out one one my redirects was from /directory to /directory/, so the actual numbers of possible redirections are +1.

1 Answers

Yes, you can use the postman console to view all the urls.

See the red box on the left lower corner. Click on it to access the console.

Hope it helps :)

Related