'use strict';

const http = require('http');

let request = {};

request.get = function(url) {
  return new Promise((resolve, reject) => {
    let req = http.get(url, (res) => {
      if (res.statusCode == 400) {
        reject(new Error(`GET request to ${url} failed, status: ${res.statusCode}`));
      }

      let body = [];

      res.on('data', (chunk) => body.push(chunk));
      res.on('end', () => resolve(body.join('')));
    });

    req.on('error', (err) => reject(err));
  });
};

module.exports = request;
@@ -180,16 +180,45 @@
      if 
+(%5B400, 401, 03, 404%5D.includes
 (res.sta
@@ -228,15 +228,9 @@
 Code
- == 400
+)
 ) %7B%0A
@@ -457,16 +457,16 @@
    %7D);%0A%0A
-
     req.
@@ -510,16 +510,512 @@
 %7D);%0A%7D;%0A%0A
+request.post = function(options, data) %7B%0A  return new Promise((resolve, reject) =%3E %7B%0A    let req = http.request(options, (res) =%3E %7B%0A      res.setEncoding('utf8');%0A      console.log(%60STATUS: $%7Bres.statusCode%7D%60);%0A      console.log(%60HEADERS: $%7BJSON.stringify(res.headers)%7D%60);%0A%0A      let body = %5B%5D;%0A%0A      res.on('data', (chunk) =%3E body.push(chunk));%0A      res.on('end', () =%3E resolve(body.join('')));%0A    %7D);%0A%0A    req.on('error', (err) =%3E reject(err));%0A    req.write(data);%0A    req.end();%0A  %7D);%0A%7D;%0A%0A
 module.e

Create post request helper