mirror of
https://github.com/danbulant/bpm
synced 2026-05-19 04:08:47 +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
|
||||
*/
|
||||
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) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue