Open bergera opened 8 years ago
I was about to post the same thing.
The WebResponse
class needs updates to properly locate
First method that requires attention is the one that retrieve status code:
This needs to be made aware of possible redirects, in which case it should keep processing requests until it gets to the last one made.
Probably every method called in this section requires attention:
For posterity reason, I would like to add, that for me, by using httpS instead of http for the endpoint that I want to reach, it got around the redirect/301 issue.
Again, probably not going to magically solve all 301 redirect problem but it should be the first thing to try if you are in similar boat. i.e. try to directly reach the end destination (in my case... the http > https address).
This issue is still unsolved. Is there any solution or still need to manually parse the HTTP response
On Mac,
WebResponse.web_ExtractResponseTextFromCurlResponse()
improperly handles responses which get redirected.In this example, the raw output of curl includes the HTTP 301 response, followed by a blank line, followed by the desired HTTP 200 response, followed by a blank line, then the reponse body.
web_ExtractResponseTextFromCurlResponse
then returns everything after the first blank line as the response content, which includes HTTP headers.This silly example is solved simply by adding another
/
to the end of the URL, and our actual use case probably won't involve redirects, but I thought it worthwhile to report.Thanks for this great library, it solves a lot of problems for us!
Example Code
Raw curl Response
Error Message