"use strict";

exports.log = log;

function log(...args) {
    console.log(new Date(), ...args); /* eslint no-console:off */
}

@@ -26,16 +26,43 @@
 g = log;
+%0Aexports.request = request;
 %0A%0Afuncti
@@ -147,8 +147,1131 @@
 ff */%0A%7D%0A
+%0Aconst urlParse = require(%22url%22).parse;%0Aconst https = require(%22https%22);%0Aconst querystring = require(%22querystring%22);%0A%0Afunction request(%7B%0A    url = %22%22,%0A    method = %22GET%22,%0A    headers = %7B%7D,%0A    body = null,%0A    qs = %7B%7D%0A%7D = %7B%7D, callback) %7B%0A    const reqUrl = urlParse(url);%0A    const host = reqUrl.hostname;%0A    const port = reqUrl.port %7C%7C 443;%0A%0A    let path = reqUrl.path;%0A%0A    if (method === %22GET%22) %7B%0A        path += %60?$%7Bquerystring.stringify(qs)%7D%60;%0A    %7D%0A%0A    if (body) %7B%0A        headers%5B%22Content-Type%22%5D = %22application/json%22;%0A        headers%5B%22Content-Length%22%5D = body.length;%0A    %7D%0A%0A    const requestOptions = %7B%0A        host,%0A        port,%0A        path,%0A        method,%0A        headers%0A    %7D;%0A%0A    function requestResponse(res) %7B%0A        res.setEncoding(%22utf8%22);%0A%0A        let rawData = %22%22;%0A%0A        res.on(%22data%22, chunk =%3E %7B%0A            rawData += chunk;%0A        %7D);%0A%0A        res.on(%22end%22, () =%3E callback(null, res, rawData));%0A    %7D%0A%0A    const req = https.request(requestOptions, requestResponse);%0A%0A    req.on(%22error%22, err =%3E callback(err));%0A%0A    if (body) %7B%0A        req.write(JSON.stringify(body));%0A    %7D%0A%0A    req.end();%0A%7D%0A

add custom request