querystring

This commit is contained in:
Flummi 2018-09-08 19:39:27 +02:00
parent 7423f2ae3a
commit d55586ce55

View File

@ -1,6 +1,7 @@
import http from "http";
import https from "https";
import url from "url";
import querystring from "querystring";
export default (a, options = {}, link = url.parse(a)) => new Promise((resolve, reject) => {
options = {...{
@ -10,7 +11,7 @@ export default (a, options = {}, link = url.parse(a)) => new Promise((resolve, r
}, ...options};
let body = "";
if(options.method === "POST") {
body = JSON.stringify(options.body);
body = querystring.stringify(options.body);
delete options.body;
options.headers = {
"Content-Type": "application/x-www-form-urlencoded",