fix(core): update
This commit is contained in:
parent
2b9e7f6dd2
commit
e86f14b8d8
@ -85,7 +85,8 @@ const httpsAgentKeepAliveFalse = new plugins.https.Agent({
|
|||||||
export let request = async (
|
export let request = async (
|
||||||
domainArg: string,
|
domainArg: string,
|
||||||
optionsArg: interfaces.ISmartRequestOptions = {},
|
optionsArg: interfaces.ISmartRequestOptions = {},
|
||||||
streamArg: boolean = false
|
responseStreamArg: boolean = false,
|
||||||
|
requestDataFunc: (req: plugins.http.ClientRequest) => void = null
|
||||||
): Promise<IExtendedIncomingMessage> => {
|
): Promise<IExtendedIncomingMessage> => {
|
||||||
const done = plugins.smartpromise.defer<any>();
|
const done = plugins.smartpromise.defer<any>();
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ export let request = async (
|
|||||||
|
|
||||||
// lets perform the actual request
|
// lets perform the actual request
|
||||||
const requestToFire = requestModule.request(optionsArg, async response => {
|
const requestToFire = requestModule.request(optionsArg, async response => {
|
||||||
if (streamArg) {
|
if (responseStreamArg) {
|
||||||
done.resolve(response);
|
done.resolve(response);
|
||||||
} else {
|
} else {
|
||||||
const builtResponse = await buildUtf8Response(response, optionsArg.autoJsonParse);
|
const builtResponse = await buildUtf8Response(response, optionsArg.autoJsonParse);
|
||||||
@ -159,6 +160,8 @@ export let request = async (
|
|||||||
requestToFire.write(optionsArg.requestBody);
|
requestToFire.write(optionsArg.requestBody);
|
||||||
requestToFire.end();
|
requestToFire.end();
|
||||||
}
|
}
|
||||||
|
} else if (requestDataFunc) {
|
||||||
|
requestDataFunc(requestToFire);
|
||||||
} else {
|
} else {
|
||||||
requestToFire.end();
|
requestToFire.end();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user