Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hubeau-api

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubeau-api - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

35

dist/cjs/http/index.js

@@ -42,27 +42,20 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var https_1 = __importDefault(require("https"));
var superagent_1 = __importDefault(require("superagent"));
var constants_1 = require("../constants");
function getRequest(entryPoint, args) {
return __awaiter(this, void 0, void 0, function () {
var res, err_1;
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
var options = {
hostname: constants_1.hostname,
path: "".concat(entryPoint).concat(args),
port: 443,
method: 'GET',
};
var body = [];
var req = https_1.default.request(options, function (res) {
res.on('data', function (chunk) { return body.push(chunk); });
res.on('end', function () {
var data = Buffer.concat(body).toString();
resolve(data);
});
});
req.on('error', function (e) {
reject(e);
});
req.end();
})];
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, superagent_1.default.get("https://".concat(constants_1.hostname).concat(entryPoint).concat(args))];
case 1:
res = _a.sent();
return [2 /*return*/, res.text];
case 2:
err_1 = _a.sent();
return [2 /*return*/, err_1.toString()];
case 3: return [2 /*return*/];
}
});

@@ -69,0 +62,0 @@ });

@@ -37,27 +37,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import https from 'https';
import superagent from 'superagent';
import { hostname } from '../constants';
function getRequest(entryPoint, args) {
return __awaiter(this, void 0, void 0, function () {
var res, err_1;
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
var options = {
hostname: hostname,
path: "".concat(entryPoint).concat(args),
port: 443,
method: 'GET',
};
var body = [];
var req = https.request(options, function (res) {
res.on('data', function (chunk) { return body.push(chunk); });
res.on('end', function () {
var data = Buffer.concat(body).toString();
resolve(data);
});
});
req.on('error', function (e) {
reject(e);
});
req.end();
})];
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, superagent.get("https://".concat(hostname).concat(entryPoint).concat(args))];
case 1:
res = _a.sent();
return [2 /*return*/, res.text];
case 2:
err_1 = _a.sent();
return [2 /*return*/, err_1.toString()];
case 3: return [2 /*return*/];
}
});

@@ -64,0 +57,0 @@ });

7

package.json
{
"name": "hubeau-api",
"version": "0.0.14",
"version": "0.0.15",
"description": "hubeau api wrapper in javascript",

@@ -49,3 +49,6 @@ "keywords": [

"license": "ISC",
"dependencies": {}
"dependencies": {
"@types/superagent": "^4.1.13",
"superagent": "^6.1.0"
}
}

@@ -1,2 +0,2 @@

import https from 'https';
import superagent from 'superagent';
import { hostname } from '../constants';

@@ -8,26 +8,10 @@

): Promise<string> {
return new Promise((resolve, reject) => {
const options = {
hostname,
path: `${entryPoint}${args}`,
port: 443,
method: 'GET',
};
const body: Uint8Array[] = [];
const req = https.request(options, res => {
res.on('data', chunk => body.push(chunk));
res.on('end', () => {
const data = Buffer.concat(body).toString();
resolve(data);
});
});
req.on('error', e => {
reject(e);
});
req.end();
});
try {
const res = await superagent.get(`https://${hostname}${entryPoint}${args}`);
return res.text;
} catch (err: any) {
return err.toString();
}
}
export default getRequest;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc