fix(core): update
This commit is contained in:
@@ -15,6 +15,7 @@ export let get = async (domainArg: string, optionsArg: interfaces.ISmartRequestO
|
||||
};
|
||||
|
||||
export let getBinary = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
||||
const done = plugins.smartq.defer();
|
||||
const response = await request(domainArg, optionsArg, true);
|
||||
var data = [];
|
||||
|
||||
@@ -26,7 +27,9 @@ export let getBinary = async (domainArg: string, optionsArg: interfaces.ISmartRe
|
||||
//of all of them together
|
||||
const buffer = Buffer.concat(data);
|
||||
response.body = buffer.toString('base64');
|
||||
done.resolve();
|
||||
});
|
||||
await done.promise;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,6 @@ import * as url from 'url';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
|
||||
import * as q from 'smartq';
|
||||
import * as smartq from 'smartq';
|
||||
|
||||
export { url, http, https, q };
|
||||
export { url, http, https, smartq };
|
||||
|
@@ -9,7 +9,7 @@ export interface extendedIncomingMessage extends IncomingMessage {
|
||||
};
|
||||
|
||||
let buildResponse = (incomingMessageArg: IncomingMessage): Promise<extendedIncomingMessage> => {
|
||||
let done = plugins.q.defer<extendedIncomingMessage>();
|
||||
let done = plugins.smartq.defer<extendedIncomingMessage>();
|
||||
// Continuously update stream with data
|
||||
let body = '';
|
||||
incomingMessageArg.on('data', function(chunkArg) {
|
||||
@@ -32,7 +32,7 @@ export let request = async (
|
||||
optionsArg: interfaces.ISmartRequestOptions = {},
|
||||
streamArg: boolean = false
|
||||
): Promise<extendedIncomingMessage> => {
|
||||
let done = plugins.q.defer<any>();
|
||||
let done = plugins.smartq.defer<any>();
|
||||
let parsedUrl: plugins.url.Url;
|
||||
if (domainArg) {
|
||||
parsedUrl = plugins.url.parse(domainArg);
|
||||
|
Reference in New Issue
Block a user