Bugfix
This commit is contained in:
@@ -37,18 +37,23 @@ export default function httpRequest<
|
||||
delete params.query;
|
||||
delete params.urlEncodedFormBody;
|
||||
|
||||
let finalHeaders: http.OutgoingHttpHeaders = {
|
||||
"Content-Type": isUrlEncodedFormBody
|
||||
? "application/x-www-form-urlencoded"
|
||||
: "application/json",
|
||||
};
|
||||
|
||||
if (reqPayloadString) {
|
||||
finalHeaders["Content-Length"] =
|
||||
Buffer.from(reqPayloadString).length;
|
||||
}
|
||||
|
||||
finalHeaders = { ...finalHeaders, ...params.headers };
|
||||
|
||||
/** @type {import("node:https").RequestOptions} */
|
||||
const requestOptions: import("node:https").RequestOptions = {
|
||||
...params,
|
||||
headers: {
|
||||
"Content-Type": isUrlEncodedFormBody
|
||||
? "application/x-www-form-urlencoded"
|
||||
: "application/json",
|
||||
"Content-Length": reqPayloadString
|
||||
? Buffer.from(reqPayloadString).length
|
||||
: undefined,
|
||||
...params.headers,
|
||||
},
|
||||
headers: finalHeaders,
|
||||
port: paramScheme == "https" ? 443 : params.port,
|
||||
path: finalPath,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user