Ask a Question

Request is sent to another URL, how to handle cookies for this redirection?

ymkocv
Occasional Contributor

Request is sent to another URL, how to handle cookies for this redirection?

Hi,

 

using Soap UI 5.5 I have endpoint + resourse, but when sending the request, the RAW information shows totally different URL

As I see from the log, there is redirection and another URL needs cookie received from the first call. How to handle such requests? Now I've got  http 403

Tested the same in Postman - request is sent correct and has http 200

9 REPLIES 9
Lucian
Community Hero

Afaik, SoapUI doesn't know how to handle cookies when there are multiple hosts involved. Another possibility would be to disable automatic redirects for this request and handle the cookies yourself (extract the set cookie value and then use it in the subsequent requests).



If my answer helped please click on the 'Accept as Solution' button.
ymkocv
Occasional Contributor

Thank you, @Lucian!

How can I disable automatic redirects? I haven't found any setting for that. Thanks!

Lucian
Community Hero

You can click on the http request and then you'll have a little space with some settings on the bottom of the screen (see the picture below)

 

2019-06-03_11h51_01.png



If my answer helped please click on the 'Accept as Solution' button.
ymkocv
Occasional Contributor

wow, thank you @Lucian ! I'll try!

Lucian
Community Hero

Smiley Very Happy



If my answer helped please click on the 'Accept as Solution' button.
ymkocv
Occasional Contributor

Actually that does not help because cookie is received somewehere during redirects 😞

Lucian
Community Hero

That's why I proposed for you to disable the automatic redirects.



If my answer helped please click on the 'Accept as Solution' button.
ymkocv
Occasional Contributor

Yes, I've disabled it, but I do not know on which step I can get a cookie.

Lucian
Community Hero

Well that should be quite simple, isn't it?

 

You start by making the first request (the one for which the redirects were handled automatically). That request should either have a Set-Cookie header right away or just a redirect location (thus a Location header). If you're just getting a Location header then create a new request to that location (don't forget to disable the redirects for that request as well).

 

Next off, if your redirect request still doesn't have a Set-Cookie header, you might want to repeat the steps above, so take the Location header again, create a new request etc. You might encounter multiple redirects until you finish off landing on some page.

 

Let me know how it goes for you 😄



If my answer helped please click on the 'Accept as Solution' button.
cancel
Showing results for 
Search instead for 
Did you mean: