HTTP Request - Automatically allow redirects

Hi Everyone,

image

I am using HTTP request POST method to retrieve some headers and it is returning 200 instead of 302. I need to get 302’s header.

The same issue was there in Postman and it is resolved after ‘Settings->Headers->Automatically follow redirects’ option is turned off.

Can anyone please help me to sort this out?

1 Like

Hey @AhmetALTIN

Sorry, Unable to understand the whole picture here, If you can explain it please…

Thanks
#nK

Hi,

When i click this Sign In button on browser
image

Its automaticly sends 2 request (first : 1 post, second 1 get)

When i do this with uipath http request, only “get request (200 status)” headers will shown me. But i need “post requests’s (302 status)” headers to get token. So i need to do this without redirects or i need to take header before redirect. I hope I explained well, sorry for my language.

1 Like

I can’t speak to the site you are automating, but a HTTP 302 Found should be be returning a Location Header to which the agent may use the Location header automatically redirect to the temporary different URI.

According to RFC7231 for historical reasons, a User Agent may change the request method from a POST to a GET for subsequent requests and recommends other response codes (HTTP 307 Temporary Redirect) if this behavior is undesired.

Reviewing the documentation for UiPath.WebAPI.Activities.HttpClient I do not see an option to disable the following of the redirection. My suggestion would be to try and capture the Output Headers and if that doesn’t capture what you need, to submit an Idea / Enhancement in the Ideas / Activities section (Or we can move this thread over as well).

Alternatively, could review other packages available that provide similar functionality to see if they have the feature you are looking for.

1 Like

Okay interesting and tricky.

Should check it !

1 Like

Hey Tim. Let me keep this thread in this section, because maybe someone suggest the anotherway, (like request with curl or request with command prompt etc.) I will open new thread at Ideas section.

Thank you for your kind reply.

1 Like

Hello, I’m facing the same issue.
In the endpoint, there is a redirect URL.
That’s why i get statuscode 200 instead of 302.
Is there already a solution for this?
Or is there a code I can use to achieve the same thing? To disable the ‘automatically follow redirects’?
I already find the following post: How to check whether the URLs is redirecting or not
But then I don’t get the correct location in the headers of the response: “message”: “https://… error_description=Failed%20to%20get%20resource%20owner%20session%20from%20request&error=invalid_request”,

No. Even that solution which u shared i couldnt get the correct respond and i stopped trying to solve :frowning: