add HttpRequestOptions.dontFollowRedirects (#3473)

This implements the option to have http.request() not follow server's 3xx redirection replies
but instead return the exact redirection code and headers.

* on iOS, it uses a different NSURLSession instance for non-following request,
  with a NSURLSessionTaskDelegate implementing URLSessinTaskWillPerformHTTPRedirection...

* on Android, it just passes the option on to org.nativescript.widgets.Async.Http;
  so this requires the respective commit in tns-core-modules-widgets to work
This commit is contained in:
Daniel Turing
2017-01-12 10:18:20 +01:00
committed by Vladimir Enchev
parent 4f3f09e9ae
commit ee4b790728
4 changed files with 40 additions and 1 deletions

View File

@@ -155,6 +155,9 @@ function buildJavaOptions(options: http.HttpRequestOptions) {
if (types.isNumber(options.timeout)) {
javaOptions.timeout = options.timeout;
}
if (types.isBoolean(options.dontFollowRedirects)) {
javaOptions.dontFollowRedirects = options.dontFollowRedirects;
}
if (options.headers) {
var arrayList = new java.util.ArrayList<org.nativescript.widgets.Async.Http.KeyValuePair>();