This commit is contained in:
Benjamin Toby
2025-01-05 09:00:50 +01:00
parent b2f5ff1377
commit 9f77036b91
5 changed files with 22 additions and 21 deletions
+1 -10
View File
@@ -1,10 +1 @@
export type HttpRequestExtraParams = {
scheme?: "http" | "https";
body?: {
[x: string]: any;
};
query?: {
[x: string]: any;
};
urlEncodedFormBody?: boolean;
};
export {};
@@ -6,18 +6,9 @@ import querystring from "querystring";
import serializeQuery from "../../utils/serialize-query";
import _ from "lodash";
/**
* @typedef {object} HttpRequestExtraParams
* @property {"http" | "https"} [scheme]
* @property {Object<string, any>} [body]
* @property {Object<string, any>} [query]
* @property {boolean} [urlEncodedFormBody]
*/
/**
* # Generate a http Request
* @param {import("node:https").RequestOptions & HttpRequestExtraParams} params
*
* @param {import("../../types").HttpRequestParams} params *
* @returns { Promise<Object<string, any> | string | null> }
*/
async function httpRequest(params) {