„src/index.mjs“ ändern

This commit is contained in:
Flummi 2023-05-02 00:36:18 +00:00
parent 58127728ec
commit cf2728cf97

View File

@ -19,10 +19,10 @@ export default (a, options = {}, link = url.parse(a), body = "") => new Promise(
if(options.method === "POST") {
body = typeof options.body === "object" ? querystring.stringify(options.body) : options.body;
delete options.body;
options.headers = {...options.headers, ...{
options.headers = {...{
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": Buffer.byteLength(body)
}};
}, ...options.headers};
}
(link.protocol === "https:"?https:http).request(options, res => resolve({
body: res,