Handling redirection
ASIHTTPRequest will automatically redirect to a new URL when it encounters one of the following HTTP status codes, assuming a Location header was sent:
- 301 Moved Permanently
- 302 Found
- 303 See Other
When redirection occurs, the value of the response data (responseHeaders / responseCookies / responseData / responseString etc) will reflect the content received from the final location.
Cookies set on any of the urls encountered during a redirection cycle will be stored in the global cookie store, and will be represented to the server on the redirected request when appropriate.
You can turn off automatic redirection by setting the request’s shouldRedirect property to NO.
![](https://i-blog.csdnimg.cn/blog_migrate/6f1567765b01b0b6106a446342825dbc.png)
By default, automatic redirects always redirect using a GET request (with no body). This behaviour matches the way most browsers work, not the HTTP spec, which specifies that 301 and 302 redirects should use the original method.
To preserve the original method (including the request body) for 301 and 302 redirects, setshouldUseRFC2616RedirectBehaviour to YES on the request before you start it.
这个属性的意思是,ASIHTTPRequest 默认会自动帮你 redirection,但是默认是用 "GET" 的方式,如果你的 request 是 Post,那么你要把 setshouldUseRFC2616RedirectBehaviour to YES