http-redirectpostmanweb-api-testing

How can I access the redirected url in postman?


I'm sending a request on postman which is redirected upon completion. I can see the redirected url in Postman console. But I can't access it from the test tab.

How can one access the redirected url?


Solution

  • You can turn off redirects on a specific request (toggle Automatically follow redirects):

    Disable request redirects

    Then you can access the Location header contents through: pm.response.headers.get('Location')

    Following that, you can hit the redirect URL via sendRequest or saving the URL in a Postman variable and using setNextRequest.