„src/index.mjs“ ändern
This commit is contained in:
parent
58127728ec
commit
cf2728cf97
|
@ -19,10 +19,10 @@ export default (a, options = {}, link = url.parse(a), body = "") => new Promise(
|
||||||
if(options.method === "POST") {
|
if(options.method === "POST") {
|
||||||
body = typeof options.body === "object" ? querystring.stringify(options.body) : options.body;
|
body = typeof options.body === "object" ? querystring.stringify(options.body) : options.body;
|
||||||
delete options.body;
|
delete options.body;
|
||||||
options.headers = {...options.headers, ...{
|
options.headers = {...{
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
"Content-Length": Buffer.byteLength(body)
|
"Content-Length": Buffer.byteLength(body)
|
||||||
}};
|
}, ...options.headers};
|
||||||
}
|
}
|
||||||
(link.protocol === "https:"?https:http).request(options, res => resolve({
|
(link.protocol === "https:"?https:http).request(options, res => resolve({
|
||||||
body: res,
|
body: res,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user