mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #77 from NativeScript/dontFollowRedirects
dontFollowRedirects added
This commit is contained in:
@@ -288,6 +288,7 @@ public class Async
|
||||
public int timeout = -1;
|
||||
public int screenWidth = -1;
|
||||
public int screenHeight = -1;
|
||||
public boolean dontFollowRedirects = false;
|
||||
|
||||
public void addHeaders(HttpURLConnection connection)
|
||||
{
|
||||
@@ -522,6 +523,11 @@ public class Async
|
||||
connection.setConnectTimeout(options.timeout);
|
||||
}
|
||||
|
||||
// don't follow redirect (30x) responses; by default, HttpURLConnection follows them.
|
||||
if (options.dontFollowRedirects) {
|
||||
connection.setInstanceFollowRedirects(false);
|
||||
}
|
||||
|
||||
// Do not attempt to write the content (body) for DELETE method, Java will throw directly
|
||||
if (!requestMethod.equals(DELETE_METHOD))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user