crayon
crayon copied to clipboard
HTTP library: Add an option to follow redirects
The following status codes...
MOVED_PERMANENTLY = 301, MOVED_TEMPORARILY = 302, SEE_OTHER = 303, (maybe) TEMPORARY_REDIRECT = 307, PERMANENT_REDIRECT = 308,
...should automatically redirect the request if the user enables that via an option like...
request = new HttpRequest(url)
.enableRedirects()
.sendAsync();
Also remember to note the differences in changing POST to GET between 301/302 and 307/308
There's actually a more important bug here: some platforms' underlying HTTP implementation already do this by default and some do not.