cloudtables-api
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -40,3 +40,3 @@ /*! CloudTables API client | ||
role?: string; | ||
/** Use http or https */ | ||
/** Allow a self signed certificate to be accepted or not (still https) */ | ||
secure?: boolean; | ||
@@ -86,3 +86,3 @@ } | ||
/** | ||
* Make an http(s) request to get data | ||
* Make an https request to get data | ||
*/ | ||
@@ -89,0 +89,0 @@ private _request; |
@@ -42,3 +42,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var http = require("http"); | ||
var https = require("https"); | ||
@@ -143,4 +142,3 @@ var querystring = require("querystring"); | ||
var opts = this._options; | ||
var protocol = opts.secure ? 'https' : 'http'; | ||
return "<script src=\"" + protocol + "://" + this._subdomain + "." + opts.domain + "/loader/" + datasetId + "/table/" + style + "\" data-token=\"" + token + "\"></script>"; | ||
return "<script src=\"https://" + this._subdomain + "." + opts.domain + "/loader/" + datasetId + "/table/" + style + "\" data-token=\"" + token + "\"></script>"; | ||
}; | ||
@@ -175,3 +173,3 @@ /** | ||
/** | ||
* Make an http(s) request to get data | ||
* Make an https request to get data | ||
*/ | ||
@@ -182,3 +180,3 @@ CloudTablesApi.prototype._request = function (path, type, data) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var opts, postData, protocol, options, promise; | ||
var opts, postData, options, promise; | ||
return __generator(this, function (_b) { | ||
@@ -195,3 +193,2 @@ opts = this._options; | ||
postData = querystring.stringify(data); | ||
protocol = opts.secure ? https : http; | ||
options = {}; | ||
@@ -216,4 +213,9 @@ if (type === 'POST') { | ||
} | ||
// Allow self signed certificates | ||
if (!opts.secure) { | ||
options.rejectUnauthorized = false; | ||
options.agent = false; | ||
} | ||
promise = new Promise(function (resolve, reject) { | ||
var req = protocol.request(options, function (res) { | ||
var req = https.request(options, function (res) { | ||
res.on('data', function (d) { | ||
@@ -220,0 +222,0 @@ var json = JSON.parse(d); |
{ | ||
"name": "cloudtables-api", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "API interface to CloudTables", | ||
@@ -5,0 +5,0 @@ "main": "dist/CloudTablesApi.js", |
@@ -5,3 +5,2 @@ /*! CloudTables API client | ||
import * as http from 'http'; | ||
import * as https from 'https'; | ||
@@ -76,3 +75,3 @@ import * as querystring from 'querystring'; | ||
/** Use http or https */ | ||
/** Allow a self signed certificate to be accepted or not (still https) */ | ||
secure?: boolean; | ||
@@ -164,5 +163,4 @@ } | ||
let opts = this._options; | ||
let protocol = opts.secure ? 'https' : 'http'; | ||
return `<script src="${protocol}://${this._subdomain}.${opts.domain}/loader/${datasetId}/table/${style}" data-token="${token}"></script>`; | ||
return `<script src="https://${this._subdomain}.${opts.domain}/loader/${datasetId}/table/${style}" data-token="${token}"></script>`; | ||
} | ||
@@ -191,3 +189,3 @@ | ||
/** | ||
* Make an http(s) request to get data | ||
* Make an https request to get data | ||
*/ | ||
@@ -209,3 +207,2 @@ private async _request<T>(path: string, type: 'GET' | 'POST', data: any = {}): Promise<T> { | ||
let postData = querystring.stringify(data as any); | ||
let protocol = opts.secure ? https : http; | ||
let options: https.RequestOptions = {}; | ||
@@ -232,4 +229,10 @@ | ||
// Allow self signed certificates | ||
if (! opts.secure) { | ||
options.rejectUnauthorized = false; | ||
options.agent = false; | ||
} | ||
let promise = new Promise<T>((resolve, reject) => { | ||
let req = protocol.request(options, (res: any) => { | ||
let req = https.request(options, (res: any) => { | ||
res.on('data', (d: string) => { | ||
@@ -236,0 +239,0 @@ let json = JSON.parse(d); |
@@ -15,7 +15,11 @@ { | ||
"strictNullChecks": true, | ||
"outDir": "../dist/" | ||
"outDir": "../dist/", | ||
"skipLibCheck": true, | ||
}, | ||
"files": [ | ||
"./CloudTablesApi.ts" | ||
] | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
] | ||
} |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
1
23156
6
561