querystring
This commit is contained in:
parent
7423f2ae3a
commit
d55586ce55
|
@ -1,6 +1,7 @@
|
||||||
import http from "http";
|
import http from "http";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import url from "url";
|
import url from "url";
|
||||||
|
import querystring from "querystring";
|
||||||
|
|
||||||
export default (a, options = {}, link = url.parse(a)) => new Promise((resolve, reject) => {
|
export default (a, options = {}, link = url.parse(a)) => new Promise((resolve, reject) => {
|
||||||
options = {...{
|
options = {...{
|
||||||
|
@ -10,7 +11,7 @@ export default (a, options = {}, link = url.parse(a)) => new Promise((resolve, r
|
||||||
}, ...options};
|
}, ...options};
|
||||||
let body = "";
|
let body = "";
|
||||||
if(options.method === "POST") {
|
if(options.method === "POST") {
|
||||||
body = JSON.stringify(options.body);
|
body = querystring.stringify(options.body);
|
||||||
delete options.body;
|
delete options.body;
|
||||||
options.headers = {
|
options.headers = {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user