From d55586ce5520d4119fa0900ef15ce8736fc62364 Mon Sep 17 00:00:00 2001 From: Flummi Date: Sat, 8 Sep 2018 19:39:27 +0200 Subject: [PATCH] querystring --- src/inc/fetch.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inc/fetch.mjs b/src/inc/fetch.mjs index 43da4de..1a7c2c7 100644 --- a/src/inc/fetch.mjs +++ b/src/inc/fetch.mjs @@ -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",