@nativescript/core 9.0.18-next.3 → 9.0.18-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/http/http-interfaces.d.ts +9 -10
- package/http/http-interfaces.js.map +1 -1
- package/http/http-request/http-request-common.d.ts +1 -0
- package/http/http-request/http-request-common.js +8 -0
- package/http/http-request/http-request-common.js.map +1 -1
- package/http/http-request/index.android.d.ts +1 -2
- package/http/http-request/index.android.js +54 -260
- package/http/http-request/index.android.js.map +1 -1
- package/http/http-request/index.d.ts +1 -1
- package/http/http-request/index.ios.d.ts +1 -2
- package/http/http-request/index.ios.js +35 -214
- package/http/http-request/index.ios.js.map +1 -1
- package/http/http-request-internal/http-request-internal-common.d.ts +2 -0
- package/http/http-request-internal/http-request-internal-common.js +12 -0
- package/http/http-request-internal/http-request-internal-common.js.map +1 -0
- package/http/http-request-internal/index.android.d.ts +4 -0
- package/http/http-request-internal/index.android.js +204 -0
- package/http/http-request-internal/index.android.js.map +1 -0
- package/http/http-request-internal/index.d.ts +28 -0
- package/http/http-request-internal/index.ios.d.ts +4 -0
- package/http/http-request-internal/index.ios.js +181 -0
- package/http/http-request-internal/index.ios.js.map +1 -0
- package/http/index.d.ts +1 -1
- package/http/index.js.map +1 -1
- package/image-source/index.android.js +2 -2
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +2 -2
- package/image-source/index.ios.js.map +1 -1
- package/package.json +1 -1
- package/http/http-shared.d.ts +0 -3
- package/http/http-shared.js +0 -2
- package/http/http-shared.js.map +0 -1
|
@@ -1,221 +1,42 @@
|
|
|
1
|
-
import { SDK_VERSION } from '../../utils/constants';
|
|
2
|
-
import { isRealDevice } from '../../utils/native-helper';
|
|
3
|
-
import * as types from '../../utils/types';
|
|
4
|
-
import * as domainDebugger from '../../debugger';
|
|
5
|
-
import { getFilenameFromUrl } from './http-request-common';
|
|
6
1
|
import { ImageSource } from '../../image-source';
|
|
7
2
|
import { File } from '../../file-system';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const queue = NSOperationQueue.mainQueue;
|
|
19
|
-
function parseJSON(source) {
|
|
20
|
-
const src = source.trim();
|
|
21
|
-
if (src.lastIndexOf(')') === src.length - 1) {
|
|
22
|
-
return JSON.parse(src.substring(src.indexOf('(') + 1, src.lastIndexOf(')')));
|
|
23
|
-
}
|
|
24
|
-
return JSON.parse(src);
|
|
25
|
-
}
|
|
26
|
-
var NSURLSessionTaskDelegateImpl = (function (_super) {
|
|
27
|
-
__extends(NSURLSessionTaskDelegateImpl, _super);
|
|
28
|
-
function NSURLSessionTaskDelegateImpl() {
|
|
29
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
-
}
|
|
31
|
-
NSURLSessionTaskDelegateImpl.prototype.URLSessionTaskWillPerformHTTPRedirectionNewRequestCompletionHandler = function (session, task, response, request, completionHandler) {
|
|
32
|
-
completionHandler(null);
|
|
33
|
-
};
|
|
34
|
-
NSURLSessionTaskDelegateImpl.ObjCProtocols = [NSURLSessionTaskDelegate];
|
|
35
|
-
return NSURLSessionTaskDelegateImpl;
|
|
36
|
-
}(NSObject));
|
|
37
|
-
const sessionTaskDelegateInstance = NSURLSessionTaskDelegateImpl.new();
|
|
38
|
-
let defaultSession;
|
|
39
|
-
function ensureDefaultSession() {
|
|
40
|
-
if (!defaultSession) {
|
|
41
|
-
defaultSession = NSURLSession.sessionWithConfigurationDelegateDelegateQueue(sessionConfig, null, queue);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
let sessionNotFollowingRedirects;
|
|
45
|
-
function ensureSessionNotFollowingRedirects() {
|
|
46
|
-
if (!sessionNotFollowingRedirects) {
|
|
47
|
-
sessionNotFollowingRedirects = NSURLSession.sessionWithConfigurationDelegateDelegateQueue(sessionConfig, sessionTaskDelegateInstance, queue);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export function request(options) {
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
if (!options.url) {
|
|
53
|
-
reject(new Error('Request url was empty.'));
|
|
54
|
-
return;
|
|
3
|
+
import { requestInternal } from '../http-request-internal';
|
|
4
|
+
import { getFilenameFromUrl, parseJSON } from './http-request-common';
|
|
5
|
+
const contentHandler = {
|
|
6
|
+
toArrayBuffer() {
|
|
7
|
+
return interop.bufferFromData(this.raw);
|
|
8
|
+
},
|
|
9
|
+
toString(encoding) {
|
|
10
|
+
const str = this.toNativeString(encoding);
|
|
11
|
+
if (typeof str === 'string') {
|
|
12
|
+
return str;
|
|
55
13
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const debugRequest = network && network.create();
|
|
59
|
-
const urlRequest = NSMutableURLRequest.requestWithURL(NSURL.URLWithString(options.url));
|
|
60
|
-
urlRequest.HTTPMethod = types.isDefined(options.method) ? options.method : GET;
|
|
61
|
-
urlRequest.setValueForHTTPHeaderField(USER_AGENT, USER_AGENT_HEADER);
|
|
62
|
-
if (options.headers) {
|
|
63
|
-
for (const header in options.headers) {
|
|
64
|
-
urlRequest.setValueForHTTPHeaderField(options.headers[header] + '', header);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (types.isString(options.content) || options.content instanceof FormData) {
|
|
68
|
-
urlRequest.HTTPBody = NSString.stringWithString(options.content.toString()).dataUsingEncoding(4);
|
|
69
|
-
}
|
|
70
|
-
else if (options.content instanceof ArrayBuffer) {
|
|
71
|
-
const buffer = options.content;
|
|
72
|
-
urlRequest.HTTPBody = NSData.dataWithData(buffer);
|
|
73
|
-
}
|
|
74
|
-
if (types.isNumber(options.timeout)) {
|
|
75
|
-
urlRequest.timeoutInterval = options.timeout / 1000;
|
|
76
|
-
}
|
|
77
|
-
let session;
|
|
78
|
-
if (types.isBoolean(options.dontFollowRedirects) && options.dontFollowRedirects) {
|
|
79
|
-
ensureSessionNotFollowingRedirects();
|
|
80
|
-
session = sessionNotFollowingRedirects;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
ensureDefaultSession();
|
|
84
|
-
session = defaultSession;
|
|
85
|
-
}
|
|
86
|
-
let timestamp = -1;
|
|
87
|
-
const dataTask = session.dataTaskWithRequestCompletionHandler(urlRequest, function (data, response, error) {
|
|
88
|
-
if (error) {
|
|
89
|
-
reject(new Error(error.localizedDescription));
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
const headers = {};
|
|
93
|
-
if (response && response.allHeaderFields) {
|
|
94
|
-
const headerFields = response.allHeaderFields;
|
|
95
|
-
headerFields.enumerateKeysAndObjectsUsingBlock((key, value, stop) => {
|
|
96
|
-
addHeader(headers, key, value);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (debugRequest) {
|
|
100
|
-
debugRequest.mimeType = response.MIMEType;
|
|
101
|
-
debugRequest.data = data;
|
|
102
|
-
const debugResponse = {
|
|
103
|
-
url: options.url,
|
|
104
|
-
status: response.statusCode,
|
|
105
|
-
statusText: NSHTTPURLResponse.localizedStringForStatusCode(response.statusCode),
|
|
106
|
-
headers: headers,
|
|
107
|
-
mimeType: response.MIMEType,
|
|
108
|
-
fromDiskCache: false,
|
|
109
|
-
timing: {
|
|
110
|
-
requestTime: timestamp,
|
|
111
|
-
proxyStart: -1,
|
|
112
|
-
proxyEnd: -1,
|
|
113
|
-
dnsStart: -1,
|
|
114
|
-
dnsEnd: -1,
|
|
115
|
-
connectStart: -1,
|
|
116
|
-
connectEnd: -1,
|
|
117
|
-
sslStart: -1,
|
|
118
|
-
sslEnd: -1,
|
|
119
|
-
serviceWorkerFetchStart: -1,
|
|
120
|
-
serviceWorkerFetchReady: -1,
|
|
121
|
-
serviceWorkerFetchEnd: -1,
|
|
122
|
-
sendStart: -1,
|
|
123
|
-
sendEnd: -1,
|
|
124
|
-
receiveHeadersEnd: -1,
|
|
125
|
-
},
|
|
126
|
-
headersSize: headers?.length ?? -1,
|
|
127
|
-
};
|
|
128
|
-
debugRequest.responseReceived(debugResponse);
|
|
129
|
-
debugRequest.loadingFinished();
|
|
130
|
-
}
|
|
131
|
-
resolve({
|
|
132
|
-
content: {
|
|
133
|
-
raw: data,
|
|
134
|
-
toArrayBuffer: () => interop.bufferFromData(data),
|
|
135
|
-
toString: (encoding) => {
|
|
136
|
-
const str = NSDataToString(data, encoding);
|
|
137
|
-
if (typeof str === 'string') {
|
|
138
|
-
return str;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
throw new Error('Response content may not be converted to string');
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
toJSON: (encoding) => parseJSON(NSDataToString(data, encoding)),
|
|
145
|
-
toImage: () => {
|
|
146
|
-
return new Promise((resolve, reject) => {
|
|
147
|
-
UIImage.tns_decodeImageWithDataCompletion(data, (image) => {
|
|
148
|
-
if (image) {
|
|
149
|
-
resolve(new ImageSource(image));
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
reject(new Error('Response content may not be converted to an Image'));
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
toFile: (destinationFilePath) => {
|
|
158
|
-
if (!destinationFilePath) {
|
|
159
|
-
destinationFilePath = getFilenameFromUrl(options.url);
|
|
160
|
-
}
|
|
161
|
-
if (data instanceof NSData) {
|
|
162
|
-
// ensure destination path exists by creating any missing parent directories
|
|
163
|
-
const file = File.fromPath(destinationFilePath);
|
|
164
|
-
data.writeToFileAtomically(destinationFilePath, true);
|
|
165
|
-
return file;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
reject(new Error(`Cannot save file with path: ${destinationFilePath}.`));
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
statusCode: response.statusCode,
|
|
173
|
-
headers: headers,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
if (options.url && debugRequest) {
|
|
178
|
-
timestamp = Date.now() / 1000;
|
|
179
|
-
const request = {
|
|
180
|
-
url: options.url,
|
|
181
|
-
method: 'GET',
|
|
182
|
-
headers: options.headers,
|
|
183
|
-
timestamp,
|
|
184
|
-
headersSize: options?.headers?.length ?? -1,
|
|
185
|
-
};
|
|
186
|
-
debugRequest.requestWillBeSent(request);
|
|
187
|
-
}
|
|
188
|
-
dataTask.resume();
|
|
14
|
+
else {
|
|
15
|
+
throw new Error('Response content may not be converted to string');
|
|
189
16
|
}
|
|
190
|
-
|
|
191
|
-
|
|
17
|
+
},
|
|
18
|
+
toJSON(encoding) {
|
|
19
|
+
return parseJSON(this.toNativeString(encoding));
|
|
20
|
+
},
|
|
21
|
+
toImage() {
|
|
22
|
+
return this.toNativeImage().then((value) => new ImageSource(value));
|
|
23
|
+
},
|
|
24
|
+
toFile(destinationFilePath) {
|
|
25
|
+
if (!destinationFilePath) {
|
|
26
|
+
destinationFilePath = getFilenameFromUrl(this.requestURL);
|
|
192
27
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return encodedString.toString();
|
|
207
|
-
}
|
|
208
|
-
export function addHeader(headers, key, value) {
|
|
209
|
-
if (!headers[key]) {
|
|
210
|
-
headers[key] = value;
|
|
211
|
-
}
|
|
212
|
-
else if (Array.isArray(headers[key])) {
|
|
213
|
-
headers[key].push(value);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
const values = [headers[key]];
|
|
217
|
-
values.push(value);
|
|
218
|
-
headers[key] = values;
|
|
219
|
-
}
|
|
28
|
+
if (this.raw instanceof NSData) {
|
|
29
|
+
// ensure destination path exists by creating any missing parent directories
|
|
30
|
+
const file = File.fromPath(destinationFilePath);
|
|
31
|
+
this.raw.writeToFileAtomically(destinationFilePath, true);
|
|
32
|
+
return file;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new Error(`Cannot save file with path: ${destinationFilePath}.`);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export function request(options) {
|
|
40
|
+
return requestInternal(options, contentHandler);
|
|
220
41
|
}
|
|
221
42
|
//# sourceMappingURL=index.ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../../packages/core/http/http-request/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../../packages/core/http/http-request/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAmB,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEtE,MAAM,cAAc,GAAuB;IAC1C,aAAa;QACZ,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IACD,QAAQ,CAAwB,QAA+B;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,GAAG,CAAC;QACZ,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;IACD,MAAM,CAAwB,QAA+B;QAC5D,OAAO,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO;QACN,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,CAAwB,mBAA4B;QACzD,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC1B,mBAAmB,GAAG,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,YAAY,MAAM,EAAE,CAAC;YAChC,4EAA4E;YAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YAEhD,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;YAE1D,OAAO,IAAI,CAAC;QACb,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,+BAA+B,mBAAmB,GAAG,CAAC,CAAC;QACxE,CAAC;IACF,CAAC;CACD,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,OAA2B;IAClD,OAAO,eAAe,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function addHeader(headers, key, value) {
|
|
2
|
+
if (!headers[key]) {
|
|
3
|
+
headers[key] = value;
|
|
4
|
+
}
|
|
5
|
+
else if (Array.isArray(headers[key])) {
|
|
6
|
+
headers[key].push(value);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
headers[key] = [headers[key], value];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=http-request-internal-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-request-internal-common.js","sourceRoot":"","sources":["../../../../../packages/core/http/http-request-internal/http-request-internal-common.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,GAAW,EAAE,KAAa;IACrE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HttpResponse, HttpRequestOptions } from '../../http';
|
|
2
|
+
import { BaseHttpContent } from '.';
|
|
3
|
+
export { addHeader } from './http-request-internal-common';
|
|
4
|
+
export declare function requestInternal<T extends object>(options: HttpRequestOptions, contentHandler?: T): Promise<HttpResponse<BaseHttpContent & T>>;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Screen } from '../../platform/screen';
|
|
2
|
+
import * as domainDebugger from '../../debugger';
|
|
3
|
+
import { isObject } from '../../utils';
|
|
4
|
+
import { addHeader } from './http-request-internal-common';
|
|
5
|
+
export { addHeader } from './http-request-internal-common';
|
|
6
|
+
let requestIdCounter = 0;
|
|
7
|
+
const pendingRequests = new Map();
|
|
8
|
+
let debugRequests;
|
|
9
|
+
if (__DEV__) {
|
|
10
|
+
debugRequests = new Map();
|
|
11
|
+
}
|
|
12
|
+
let completeCallback;
|
|
13
|
+
function ensureCompleteCallback() {
|
|
14
|
+
if (completeCallback) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
completeCallback = new org.nativescript.widgets.Async.CompleteCallback({
|
|
18
|
+
onComplete: function (result, context) {
|
|
19
|
+
// as a context we will receive the id of the request
|
|
20
|
+
onRequestComplete(context, result);
|
|
21
|
+
},
|
|
22
|
+
onError: function (error, context) {
|
|
23
|
+
onRequestError(error, context);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function onRequestComplete(requestId, result) {
|
|
28
|
+
const callbacks = pendingRequests.get(requestId);
|
|
29
|
+
pendingRequests.delete(requestId);
|
|
30
|
+
if (result.error) {
|
|
31
|
+
callbacks.rejectCallback(new Error(result.error.toString()));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// read the headers
|
|
35
|
+
const headers = {};
|
|
36
|
+
if (result.headers) {
|
|
37
|
+
const jHeaders = result.headers;
|
|
38
|
+
const length = jHeaders.size();
|
|
39
|
+
let pair;
|
|
40
|
+
for (let i = 0; i < length; i++) {
|
|
41
|
+
pair = jHeaders.get(i);
|
|
42
|
+
addHeader(headers, pair.key, pair.value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (__DEV__) {
|
|
46
|
+
const debugRequestInfo = debugRequests.get(requestId);
|
|
47
|
+
if (debugRequestInfo) {
|
|
48
|
+
const debugRequest = debugRequestInfo.debugRequest;
|
|
49
|
+
let mime = (headers['Content-Type'] ?? 'text/plain');
|
|
50
|
+
if (typeof mime === 'string') {
|
|
51
|
+
mime = mime.split(';')[0] ?? 'text/plain';
|
|
52
|
+
}
|
|
53
|
+
debugRequest.mimeType = mime;
|
|
54
|
+
debugRequest.data = result.raw;
|
|
55
|
+
const debugResponse = {
|
|
56
|
+
url: result.url,
|
|
57
|
+
status: result.statusCode,
|
|
58
|
+
statusText: result.statusText,
|
|
59
|
+
headers: headers,
|
|
60
|
+
mimeType: mime,
|
|
61
|
+
fromDiskCache: false,
|
|
62
|
+
timing: {
|
|
63
|
+
requestTime: debugRequestInfo.timestamp,
|
|
64
|
+
proxyStart: -1,
|
|
65
|
+
proxyEnd: -1,
|
|
66
|
+
dnsStart: -1,
|
|
67
|
+
dnsEnd: -1,
|
|
68
|
+
connectStart: -1,
|
|
69
|
+
connectEnd: -1,
|
|
70
|
+
sslStart: -1,
|
|
71
|
+
sslEnd: -1,
|
|
72
|
+
serviceWorkerFetchStart: -1,
|
|
73
|
+
serviceWorkerFetchReady: -1,
|
|
74
|
+
serviceWorkerFetchEnd: -1,
|
|
75
|
+
sendStart: -1,
|
|
76
|
+
sendEnd: -1,
|
|
77
|
+
receiveHeadersEnd: -1,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
debugRequest.responseReceived(debugResponse);
|
|
81
|
+
debugRequest.loadingFinished();
|
|
82
|
+
debugRequests.delete(requestId);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const content = {
|
|
86
|
+
raw: result.raw,
|
|
87
|
+
requestURL: callbacks.url,
|
|
88
|
+
toNativeImage: () => {
|
|
89
|
+
return new Promise((resolveImage, rejectImage) => {
|
|
90
|
+
if (result.responseAsImage != null) {
|
|
91
|
+
resolveImage(result.responseAsImage);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
rejectImage(new Error('Response content may not be converted to an Image'));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
toNativeString: () => result.responseAsString,
|
|
99
|
+
};
|
|
100
|
+
if (callbacks.contentHandler != null && isObject(callbacks.contentHandler) && !Array.isArray(callbacks.contentHandler)) {
|
|
101
|
+
Object.assign(content, callbacks.contentHandler);
|
|
102
|
+
}
|
|
103
|
+
callbacks.resolveCallback({
|
|
104
|
+
content,
|
|
105
|
+
statusCode: result.statusCode,
|
|
106
|
+
headers: headers,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function onRequestError(error, requestId) {
|
|
110
|
+
const callbacks = pendingRequests.get(requestId);
|
|
111
|
+
pendingRequests.delete(requestId);
|
|
112
|
+
if (callbacks) {
|
|
113
|
+
callbacks.rejectCallback(new Error(error));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function buildJavaOptions(options) {
|
|
117
|
+
if (typeof options.url !== 'string') {
|
|
118
|
+
throw new Error('Http request must provide a valid url.');
|
|
119
|
+
}
|
|
120
|
+
const javaOptions = new org.nativescript.widgets.Async.Http.RequestOptions();
|
|
121
|
+
javaOptions.url = options.url;
|
|
122
|
+
if (typeof options.method === 'string') {
|
|
123
|
+
javaOptions.method = options.method;
|
|
124
|
+
}
|
|
125
|
+
if (typeof options.content === 'string' || options.content instanceof FormData) {
|
|
126
|
+
const nativeString = new java.lang.String(options.content.toString());
|
|
127
|
+
const nativeBytes = nativeString.getBytes('UTF-8');
|
|
128
|
+
const nativeBuffer = java.nio.ByteBuffer.wrap(nativeBytes);
|
|
129
|
+
javaOptions.content = nativeBuffer;
|
|
130
|
+
}
|
|
131
|
+
else if (options.content instanceof ArrayBuffer) {
|
|
132
|
+
const typedArray = new Uint8Array(options.content);
|
|
133
|
+
const nativeBuffer = java.nio.ByteBuffer.wrap(Array.from(typedArray));
|
|
134
|
+
javaOptions.content = nativeBuffer;
|
|
135
|
+
}
|
|
136
|
+
if (typeof options.timeout === 'number') {
|
|
137
|
+
javaOptions.timeout = options.timeout;
|
|
138
|
+
}
|
|
139
|
+
if (typeof options.dontFollowRedirects === 'boolean') {
|
|
140
|
+
javaOptions.dontFollowRedirects = options.dontFollowRedirects;
|
|
141
|
+
}
|
|
142
|
+
if (options.headers) {
|
|
143
|
+
const arrayList = new java.util.ArrayList();
|
|
144
|
+
const pair = org.nativescript.widgets.Async.Http.KeyValuePair;
|
|
145
|
+
for (const key in options.headers) {
|
|
146
|
+
arrayList.add(new pair(key, options.headers[key] + ''));
|
|
147
|
+
}
|
|
148
|
+
javaOptions.headers = arrayList;
|
|
149
|
+
}
|
|
150
|
+
// pass the maximum available image size to the request options in case we need a bitmap conversion
|
|
151
|
+
javaOptions.screenWidth = Screen.mainScreen.widthPixels;
|
|
152
|
+
javaOptions.screenHeight = Screen.mainScreen.heightPixels;
|
|
153
|
+
return javaOptions;
|
|
154
|
+
}
|
|
155
|
+
export function requestInternal(options, contentHandler) {
|
|
156
|
+
if (options === undefined || options === null) {
|
|
157
|
+
// TODO: Shouldn't we throw an error here - defensive programming
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
try {
|
|
162
|
+
// initialize the options
|
|
163
|
+
const javaOptions = buildJavaOptions(options);
|
|
164
|
+
// // send request data to network debugger
|
|
165
|
+
// if (global.__inspector && global.__inspector.isConnected) {
|
|
166
|
+
// NetworkAgent.requestWillBeSent(requestIdCounter, options);
|
|
167
|
+
// }
|
|
168
|
+
if (__DEV__) {
|
|
169
|
+
const network = domainDebugger.getNetwork();
|
|
170
|
+
const debugRequest = network && network.create();
|
|
171
|
+
if (options.url && debugRequest) {
|
|
172
|
+
const timestamp = Date.now() / 1000;
|
|
173
|
+
debugRequests.set(requestIdCounter, {
|
|
174
|
+
debugRequest,
|
|
175
|
+
timestamp,
|
|
176
|
+
});
|
|
177
|
+
const request = {
|
|
178
|
+
url: options.url,
|
|
179
|
+
method: 'GET',
|
|
180
|
+
headers: options.headers,
|
|
181
|
+
timestamp,
|
|
182
|
+
};
|
|
183
|
+
debugRequest.requestWillBeSent(request);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Remember the callbacks so that we can use them when the CompleteCallback is called
|
|
187
|
+
pendingRequests.set(requestIdCounter, {
|
|
188
|
+
url: options.url,
|
|
189
|
+
contentHandler,
|
|
190
|
+
resolveCallback: resolve,
|
|
191
|
+
rejectCallback: reject,
|
|
192
|
+
});
|
|
193
|
+
ensureCompleteCallback();
|
|
194
|
+
//make the actual async call
|
|
195
|
+
org.nativescript.widgets.Async.Http.MakeRequest(javaOptions, completeCallback, new java.lang.Integer(requestIdCounter));
|
|
196
|
+
// increment the id counter
|
|
197
|
+
requestIdCounter++;
|
|
198
|
+
}
|
|
199
|
+
catch (ex) {
|
|
200
|
+
reject(ex);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.android.js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eAAe,CAAC,GAAG,CAAC,gBAAgB,EAAE;gBACrC,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,cAAc;gBACd,eAAe,EAAE,OAAO;gBACxB,cAAc,EAAE,MAAM;aACtB,CAAC,CAAC;YAEH,sBAAsB,EAAE,CAAC;YACzB,4BAA4B;YAC5B,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,gBAAgB,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAExH,2BAA2B;YAC3B,gBAAgB,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACb,MAAM,CAAC,EAAE,CAAC,CAAC;QACZ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HttpRequestOptions, HttpResponse, Headers, HttpResponseEncoding, HttpContentHandler } from '../http-interfaces';
|
|
2
|
+
|
|
3
|
+
export interface BaseHttpContent {
|
|
4
|
+
/**
|
|
5
|
+
* Gets the response body as raw data.
|
|
6
|
+
*/
|
|
7
|
+
raw: any;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the request options URL.
|
|
10
|
+
*/
|
|
11
|
+
requestURL: string;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the response native image.
|
|
14
|
+
*/
|
|
15
|
+
toNativeImage: () => Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the response as native string.
|
|
18
|
+
*/
|
|
19
|
+
toNativeString: (encoding?: HttpResponseEncoding) => any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Makes a generic http request using the provided options and returns a HttpResponse Object.
|
|
24
|
+
* @param options An object that specifies various request options.
|
|
25
|
+
* @param contentHandler An object that specifies various functions to parse raw response content.
|
|
26
|
+
*/
|
|
27
|
+
export function requestInternal<T extends object>(options: HttpRequestOptions, contentHandler?: T): Promise<HttpResponse<BaseHttpContent & T>>;
|
|
28
|
+
export function addHeader(headers: Headers, key: string, value: string): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HttpRequestOptions, HttpResponse } from '../http-interfaces';
|
|
2
|
+
import { BaseHttpContent } from '.';
|
|
3
|
+
export { addHeader } from './http-request-internal-common';
|
|
4
|
+
export declare function requestInternal<T extends object>(options: HttpRequestOptions, contentHandler?: T): Promise<HttpResponse<BaseHttpContent & T>>;
|