When redirected, how to see the URL you´re redirected to?

Hi,

I´m sending a request which returns a 30x and Postman automatically follows the redirect, which is fine.
How can I programmatically “see” the URL I´m redirected to, eg in the test tab?

This has been raised as an issue before (https://github.com/postmanlabs/postman-app-support/issues/319), but as I understand the latest comment, the given solution is not working anymore?
Anyhow, I want to get that value in the test tab, not in some Addon.

Many thanks,
Christian

2 Likes

This has been answered on Twitter: https://twitter.com/ambertests/status/1153709610768859136

After you make the request, the redirect url will be in the temporary request headers

one can access them via request.headers[“referer”]

1 Like

The temporary headers are a great answer.

There is the option of turning off redirects from settings, and using a pre-request script to submit your anticipated redirected urls.

You can then use the redirect information in the 30* header to set your url for the test…