From ff990b3a95092b3fc30d0edff0ea4616fb408617 Mon Sep 17 00:00:00 2001 From: danbulant Date: Wed, 19 Feb 2020 19:45:38 +0100 Subject: [PATCH] Add options to get --- modules/requests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/requests.js b/modules/requests.js index b3e72d5..f2dfcc1 100644 --- a/modules/requests.js +++ b/modules/requests.js @@ -3,7 +3,7 @@ const https = require("https"); /** * @param {String} path */ -module.exports = (path) => { +module.exports = (path, options = { method: "GET" }) => { return new Promise((res, rej) => { if(path.startsWith("http://")){ var handler = http; @@ -13,7 +13,7 @@ module.exports = (path) => { rej(Error("Unsupported protocol")); } - handler.get(path, (resp) => { + handler.get(path, options, (resp) => { let data = ''; resp.on('data', (chunk) => {