Updates
This commit is contained in:
parent
9f256832ee
commit
549d0abc02
@ -1,2 +1,6 @@
|
|||||||
declare const _exports: import("../../types").HttpRequestFunctionType;
|
export = httpRequest;
|
||||||
export = _exports;
|
/**
|
||||||
|
* # Generate a http Request
|
||||||
|
* @type {import("../../types").HttpRequestFunction}
|
||||||
|
*/
|
||||||
|
declare const httpRequest: import("../../types").HttpRequestFunction;
|
||||||
|
@ -8,9 +8,9 @@ const _ = require("lodash");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* # Generate a http Request
|
* # Generate a http Request
|
||||||
* @type {import("../../types").HttpRequestFunctionType}
|
* @type {import("../../types").HttpRequestFunction}
|
||||||
*/
|
*/
|
||||||
module.exports = function httpRequest(params) {
|
const httpRequest = (params) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const isUrlEncodedFormBody = params.urlEncodedFormBody;
|
const isUrlEncodedFormBody = params.urlEncodedFormBody;
|
||||||
|
|
||||||
@ -81,6 +81,7 @@ module.exports = function httpRequest(params) {
|
|||||||
status: response.statusCode || 404,
|
status: response.statusCode || 404,
|
||||||
data,
|
data,
|
||||||
str,
|
str,
|
||||||
|
requestedPath: finalPath,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -89,6 +90,7 @@ module.exports = function httpRequest(params) {
|
|||||||
status: response.statusCode || 404,
|
status: response.statusCode || 404,
|
||||||
str,
|
str,
|
||||||
error: err.message,
|
error: err.message,
|
||||||
|
requestedPath: finalPath,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -105,3 +107,5 @@ module.exports = function httpRequest(params) {
|
|||||||
httpsRequest.end();
|
httpsRequest.end();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = httpRequest;
|
||||||
|
3
package-shared/types/index.d.ts
vendored
3
package-shared/types/index.d.ts
vendored
@ -1235,7 +1235,7 @@ export type HttpRequestParams<ReqObj extends {
|
|||||||
query?: ReqObj;
|
query?: ReqObj;
|
||||||
urlEncodedFormBody?: boolean;
|
urlEncodedFormBody?: boolean;
|
||||||
};
|
};
|
||||||
export type HttpRequestFunctionType<ReqObj extends {
|
export type HttpRequestFunction<ReqObj extends {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
} = {
|
} = {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
@ -1253,5 +1253,6 @@ export type HttpFunctionResponse<ResObj extends {
|
|||||||
data?: ResObj;
|
data?: ResObj;
|
||||||
error?: string;
|
error?: string;
|
||||||
str?: string;
|
str?: string;
|
||||||
|
requestedPath?: string;
|
||||||
};
|
};
|
||||||
export {};
|
export {};
|
||||||
|
@ -1453,7 +1453,7 @@ export type HttpRequestParams<
|
|||||||
urlEncodedFormBody?: boolean;
|
urlEncodedFormBody?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HttpRequestFunctionType<
|
export type HttpRequestFunction<
|
||||||
ReqObj extends { [key: string]: any } = { [key: string]: any },
|
ReqObj extends { [key: string]: any } = { [key: string]: any },
|
||||||
ResObj extends { [key: string]: any } = { [key: string]: any }
|
ResObj extends { [key: string]: any } = { [key: string]: any }
|
||||||
> = (param: HttpRequestParams<ReqObj>) => Promise<HttpFunctionResponse<ResObj>>;
|
> = (param: HttpRequestParams<ReqObj>) => Promise<HttpFunctionResponse<ResObj>>;
|
||||||
@ -1465,4 +1465,5 @@ export type HttpFunctionResponse<
|
|||||||
data?: ResObj;
|
data?: ResObj;
|
||||||
error?: string;
|
error?: string;
|
||||||
str?: string;
|
str?: string;
|
||||||
|
requestedPath?: string;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "3.3.7",
|
"version": "3.3.8",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user