mirror of
https://github.com/danbulant/bpm
synced 2026-05-24 12:21:50 +00:00
Add options to get
This commit is contained in:
parent
fc6617970c
commit
ff990b3a95
1 changed files with 2 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ const https = require("https");
|
||||||
/**
|
/**
|
||||||
* @param {String} path
|
* @param {String} path
|
||||||
*/
|
*/
|
||||||
module.exports = (path) => {
|
module.exports = (path, options = { method: "GET" }) => {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
if(path.startsWith("http://")){
|
if(path.startsWith("http://")){
|
||||||
var handler = http;
|
var handler = http;
|
||||||
|
|
@ -13,7 +13,7 @@ module.exports = (path) => {
|
||||||
rej(Error("Unsupported protocol"));
|
rej(Error("Unsupported protocol"));
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.get(path, (resp) => {
|
handler.get(path, options, (resp) => {
|
||||||
let data = '';
|
let data = '';
|
||||||
|
|
||||||
resp.on('data', (chunk) => {
|
resp.on('data', (chunk) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue