opengate-js 10.5.1 → 10.5.2
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/bower.json +1 -1
- package/dist/{opengate-api-bower-10.5.1.js → opengate-api-bower-10.5.2.js} +11 -30
- package/dist/opengate-api-bower-10.5.2.js.map +1 -0
- package/dist/{opengate-api-bower-10.5.1.min.js → opengate-api-bower-10.5.2.min.js} +3 -3
- package/dist/opengate-api-bower-10.5.2.min.js.map +1 -0
- package/dist/src/util/NorthAmpliaREST.js +8 -27
- package/dist/src/util/NorthAmpliaREST.js.map +1 -1
- package/docs/ast/source/util/NorthAmpliaREST.js.json +11552 -16264
- package/docs/class/src/util/NorthAmpliaREST.js~NorthAmpliaREST.html +4 -4
- package/docs/class/src/util/SouthAmpliaREST.js~SouthAmpliaREST.html +1 -1
- package/docs/dump.json +4 -4
- package/docs/file/src/util/NorthAmpliaREST.js.html +8 -27
- package/docs/package.json +1 -1
- package/docs/source.html +193 -193
- package/package.json +1 -1
- package/src/util/NorthAmpliaREST.js +8 -27
- package/dist/opengate-api-bower-10.5.1.js.map +0 -1
- package/dist/opengate-api-bower-10.5.1.min.js.map +0 -1
package/package.json
CHANGED
|
@@ -103,12 +103,12 @@ export default class NorthAmpliaREST {
|
|
|
103
103
|
* @param {number} timeout - timeout in milliseconds
|
|
104
104
|
* @param {object} headers - headers of request
|
|
105
105
|
* @param {object} parameters - parameters of request
|
|
106
|
-
* @param {boolean}
|
|
106
|
+
* @param {boolean} asBlob - response body as Blob
|
|
107
107
|
* @return {Promise}
|
|
108
108
|
*/
|
|
109
|
-
get(url, timeout, headers, parameters,
|
|
109
|
+
get(url, timeout, headers, parameters, asBlob) {
|
|
110
110
|
var req = request.get(this._createUrl(url, parameters));
|
|
111
|
-
return this._createPromiseRequest(req, null, timeout, headers,
|
|
111
|
+
return this._createPromiseRequest(req, null, timeout, headers, asBlob);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
@@ -259,7 +259,7 @@ export default class NorthAmpliaREST {
|
|
|
259
259
|
return returnUrl;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
_createPromiseRequest(req, events, timeout, headers,
|
|
262
|
+
_createPromiseRequest(req, events, timeout, headers, asBlob) {
|
|
263
263
|
let _timeout = timeout;
|
|
264
264
|
if (typeof _timeout === "undefined" || _timeout === null) {
|
|
265
265
|
_timeout = this._options.timeout;
|
|
@@ -287,6 +287,9 @@ export default class NorthAmpliaREST {
|
|
|
287
287
|
_req = _req.on(event, events[event]);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
+
if(asBlob){
|
|
291
|
+
req.responseType('blob')
|
|
292
|
+
}
|
|
290
293
|
_req = _req.end(function(err, res) {
|
|
291
294
|
if (err !== null) {
|
|
292
295
|
let data;
|
|
@@ -315,29 +318,7 @@ export default class NorthAmpliaREST {
|
|
|
315
318
|
'data': data
|
|
316
319
|
});
|
|
317
320
|
} else {
|
|
318
|
-
|
|
319
|
-
var chunks = []
|
|
320
|
-
res.on("data", function (chunk) {
|
|
321
|
-
chunks.push(chunk);
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
res.on("end", function (chunk) {
|
|
325
|
-
let length = 0
|
|
326
|
-
|
|
327
|
-
for(let i = 0; i < chunks.length; i++){
|
|
328
|
-
length += chunks[i].length
|
|
329
|
-
}
|
|
330
|
-
const resultArray = new Uint8Array(length)
|
|
331
|
-
let offset = 0
|
|
332
|
-
|
|
333
|
-
for(let i = 0; i < chunks.length; i++){
|
|
334
|
-
const c = chunks[i]
|
|
335
|
-
resultArray.set(c, offset)
|
|
336
|
-
offset += c.length
|
|
337
|
-
}
|
|
338
|
-
res.body = resultArray
|
|
339
|
-
});
|
|
340
|
-
}
|
|
321
|
+
|
|
341
322
|
defered.resolve(res);
|
|
342
323
|
}
|
|
343
324
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"mappings":"","sources":["opengate-api-bower.js"],"file":"opengate-api-bower-10.5.1.js","sourceRoot":".."}
|