2

In postman I want to create a GET request that returns a 302 status code (along with a Location response header). I have been trying to replicate the original request from the browser inspector, but I always get a 200 response (and no Location response header).

How can I get the desired response with the Location response header?

Alex
  • 41,580
  • 88
  • 260
  • 469

2 Answers2

3

Please try to turn off automatical redirects (File->Settings: General Tab): enter image description here

DieGraueEminenz
  • 830
  • 2
  • 8
  • 18
  • Yes that kind of worked. I also get a `Location` parameter - but a very different one: All the params are missing completely! – Alex May 27 '19 at 08:18
  • What did you get, and what did you expect? – DieGraueEminenz May 27 '19 at 09:11
  • In the browser inspect its an URL with a lot of parameters, including the login token. In Postman its just the URL without any parameters. But I need that login token! – Alex May 27 '19 at 10:55
  • @Alex Do you mean in your browser, the `302` HTTP response has `Location` header, AND it also has login token etc.? That is a really weird situation. – shaochuancs May 27 '19 at 13:11
  • 1
    The issue has been solved locally. Its related to OIDC login for wich a library can be used to handle all the requests in order to get a login session. – Alex May 28 '19 at 07:09
  • @Alex I'm having this same issue. I turned off redirects in Postman but I still can't seem to connect. – Kyle Calica-St Jul 18 '19 at 17:01
2

What is probably happening is that Postman receives a 302 status code, but is configured to redirect in this case, so it automatically redirects after which Postman receives a 200 status code, which is what you end up seeing.

Apparently turning off "automatically follow redirects" should offer you a solution. https://learning.getpostman.com/docs/postman/launching_postman/settings/ View postman request when redirects

Muhammed
  • 96
  • 4