Bugfix
This commit is contained in:
parent
4aa69791c1
commit
9f773de1a1
@ -31,12 +31,18 @@ function httpRequest(params) {
|
|||||||
delete params.scheme;
|
delete params.scheme;
|
||||||
delete params.query;
|
delete params.query;
|
||||||
delete params.urlEncodedFormBody;
|
delete params.urlEncodedFormBody;
|
||||||
/** @type {import("node:https").RequestOptions} */
|
let finalHeaders = {
|
||||||
const requestOptions = Object.assign(Object.assign({}, params), { headers: Object.assign({ "Content-Type": isUrlEncodedFormBody
|
"Content-Type": isUrlEncodedFormBody
|
||||||
? "application/x-www-form-urlencoded"
|
? "application/x-www-form-urlencoded"
|
||||||
: "application/json", "Content-Length": reqPayloadString
|
: "application/json",
|
||||||
? Buffer.from(reqPayloadString).length
|
};
|
||||||
: undefined }, params.headers), port: paramScheme == "https" ? 443 : params.port, path: finalPath });
|
if (reqPayloadString) {
|
||||||
|
finalHeaders["Content-Length"] =
|
||||||
|
Buffer.from(reqPayloadString).length;
|
||||||
|
}
|
||||||
|
finalHeaders = Object.assign(Object.assign({}, finalHeaders), params.headers);
|
||||||
|
/** @type {import("node:https").RequestOptions} */
|
||||||
|
const requestOptions = Object.assign(Object.assign({}, params), { headers: finalHeaders, port: paramScheme == "https" ? 443 : params.port, path: finalPath });
|
||||||
const httpsRequest = finalScheme.request(requestOptions,
|
const httpsRequest = finalScheme.request(requestOptions,
|
||||||
/**
|
/**
|
||||||
* Callback Function
|
* Callback Function
|
||||||
|
@ -37,18 +37,23 @@ export default function httpRequest<
|
|||||||
delete params.query;
|
delete params.query;
|
||||||
delete params.urlEncodedFormBody;
|
delete params.urlEncodedFormBody;
|
||||||
|
|
||||||
/** @type {import("node:https").RequestOptions} */
|
let finalHeaders: http.OutgoingHttpHeaders = {
|
||||||
const requestOptions: import("node:https").RequestOptions = {
|
|
||||||
...params,
|
|
||||||
headers: {
|
|
||||||
"Content-Type": isUrlEncodedFormBody
|
"Content-Type": isUrlEncodedFormBody
|
||||||
? "application/x-www-form-urlencoded"
|
? "application/x-www-form-urlencoded"
|
||||||
: "application/json",
|
: "application/json",
|
||||||
"Content-Length": reqPayloadString
|
};
|
||||||
? Buffer.from(reqPayloadString).length
|
|
||||||
: undefined,
|
if (reqPayloadString) {
|
||||||
...params.headers,
|
finalHeaders["Content-Length"] =
|
||||||
},
|
Buffer.from(reqPayloadString).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
finalHeaders = { ...finalHeaders, ...params.headers };
|
||||||
|
|
||||||
|
/** @type {import("node:https").RequestOptions} */
|
||||||
|
const requestOptions: import("node:https").RequestOptions = {
|
||||||
|
...params,
|
||||||
|
headers: finalHeaders,
|
||||||
port: paramScheme == "https" ? 443 : params.port,
|
port: paramScheme == "https" ? 443 : params.port,
|
||||||
path: finalPath,
|
path: finalPath,
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "3.8.2",
|
"version": "3.8.3",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user