turn off "automatically follow redirects" in outsystems
Question

Hello,


I am facing one issue. When I am opening postman and switching OFF “Automatically follow redirects” from settings, calling the API ,  I am getting headers in response (say 5 headers as showin in 2nd image). When it is ON , it gives different response headers(say 13 headers). I want to get the Location key which has URL. But this header response is not coming when the automatically follow redirects is ON .


When I am consuming the REST API in outsystems and using onafterresponse , I am getting 13 headers in response (which in POSTMAN I get if automatically follow redirects is ON) but I want another set of response header i.e. 5 . so how we can off this “automatically follow redirects” in outsystems?




Thanks,

Tejas

Hi Tejas,

I'm having a hard time understanding the use case here.

From what I understand you want to get the value in the Location Header and then do something with it, the problem is that when consuming the API in OutSystems that header is not available in the OnAfterResponse HTTP Header list. 

Is that it?

edited for clarity

Yes correct, Location header is not available, there are some other sets of headers are available and coming in "on after response". The reason is outsystems by default taking the other set of headers. In Postman if you try and hit the end-point you will get these differenet set of headers when your "automatic follow redirects" option is ON.


And when it is OFF, you will get Location header and other 3 headers with it. I can get both set of headers in post man but not in outsystems.


Thanks,

Tejas

Ok, got it.

Have you changed the logging level of that API to "Full" and check if the headers are logged?

I'm not aware of OutSystems removing any headers, the only thing that comes up as cause could be that the API method requires a specific input or Header before making the Request to later have the Location header in the response. Is this a public API that I can experiment with?

Hi @Cristiana Umbelino ,

Thank you for the suggestion. I have checked the logging level of the API and they are already in "Full" level. PSB the image for the same. It is not public API so can't share the details with you.

Let me know if you get any intel over it.



Thanks,

Tejas

Can you confirm that the HTTP Response Code is a 3xx?

Asking because of the definition of the Automatically follow redirects setting.

Automatically follow redirects: Turn off this toggle to prevent requests that return a 3xx series response from being automatically redirected.

Update on this thread


It seems you'll need to create a simple piece of code in .NET and use it using the AdvancedOnAfterResponse.

More info here:

Thank you @Cristiana Umbelino . This is really helpful. I will surely try this one and create one component in order to overcome this issue.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.