I'm fighting against REST API that performs a 304 redirect; what I need is to take the destination URL of the redirect and open it with the browser (I know, it's a little of a perversion). I successfully intercepted the redirect, thanks to this nice lad reversepanda: https://github.com/bustoutsolutions/siesta/issues/210 but still I didn't figure out how to take the redirect url in the callback of the GET request (success or failure)
resource.load().onSuccess{ response in
//HERE I WOULD LIKE TO TAKE THE URL OF THE REDIRECT
//(if I print the response I can see the HTML of the destination web page where the user should land)
}.onFailure{ error in
//using 'completionHandler(nil)' in the 'willPerformHTTPRedirection' method of the delegate, brings me here
}
Any suggestion on how I could resolve this problem?
Thank you!
Take a look inside RequestChain.swift, it has some comments with example which can help. I believe you can do something like:
You can search more examples with keywords
chained,useThisResponseandpassToin Siesta sources.Please, let us know if it helps to solve your issue and it would be nice to see your final solution.