Advertisement
Guest User

Untitled

a guest
Sep 7th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.   'use strict';
  3.  
  4.   function _classCallCheck(instance, Constructor) {
  5.     if (!(instance instanceof Constructor)) {
  6.       throw new TypeError("Cannot call a class as a function");
  7.     }
  8.   }
  9.  
  10.   function _defineProperties(target, props) {
  11.     for (var i = 0; i < props.length; i++) {
  12.       var descriptor = props[i];
  13.       descriptor.enumerable = descriptor.enumerable || false;
  14.       descriptor.configurable = true;
  15.       if ("value" in descriptor) descriptor.writable = true;
  16.       Object.defineProperty(target, descriptor.key, descriptor);
  17.     }
  18.   }
  19.  
  20.   function _createClass(Constructor, protoProps, staticProps) {
  21.     if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  22.     if (staticProps) _defineProperties(Constructor, staticProps);
  23.     return Constructor;
  24.   }
  25.  
  26.   var proxyConfig = {
  27.     USE_PROXY: false,
  28.     PROXY: {
  29.       PROXY_PROTOCOL: 'http',
  30.       PROXY_HOST: 'proxy.eng.it',
  31.       PROXY_PORT: '3128',
  32.       PROXY_CREDENTIAL: {
  33.         PROXY_USERNAME: 'dtrombin',
  34.         PROXY_PASSWORD: 'Accountecng1993'
  35.       }
  36.     }
  37.   };
  38.  
  39.   var HTTPClient =
  40.   /*#__PURE__*/
  41.   function () {
  42.     function HTTPClient() {
  43.       _classCallCheck(this, HTTPClient);
  44.     }
  45.  
  46.     _createClass(HTTPClient, [{
  47.       key: "get",
  48.       value: function get(url) {
  49.         var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  50.         opts.method = "GET";
  51.         fetch(url, opts);
  52.       }
  53.     }, {
  54.       key: "post",
  55.       value: function post(url) {
  56.         var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  57.         opts.method = "POST";
  58.         fetch(url, opts);
  59.       }
  60.     }, {
  61.       key: "head",
  62.       value: function head(url) {
  63.         var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  64.         opts.method = "HEAD";
  65.         fetch(url, opts);
  66.       }
  67.     }, {
  68.       key: "delete",
  69.       value: function _delete(url) {
  70.         var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  71.         opts.method = "DELETE";
  72.         fetch(url, opts);
  73.       }
  74.     }, {
  75.       key: "update",
  76.       value: function update(url) {
  77.         var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  78.         opts.method = "UPDATE";
  79.         fetch(url, opts);
  80.       }
  81.     }, {
  82.       key: "setProxy",
  83.       value: function setProxy() {
  84.         var proxy = proxyConfig.PROXY;
  85.         var proxyString = proxy.PROXY_PROTOCOL.concat("://").concat(proxy.PROXY_CREDENTIAL.PROXY_USERNAME).concat(":").concat(proxy.PROXY_CREDENTIAL.PROXY_PASSWORD).concat('@').concat(proxy.PROXY_HOST).concat(":").concat(proxy.PROXY_PORT);
  86.         return proxyString; //new HttpsProxyAgent(proxy);
  87.       }
  88.     }]);
  89.  
  90.     return HTTPClient;
  91.   }();
  92.  
  93. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement