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

appbase-js

Package Overview
Dependencies
Maintainers
4
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appbase-js - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

15

lib/fetch_request.js

@@ -55,9 +55,14 @@ "use strict";

var headers = {
"Accept": "application/json",
"Content-Type": "application/json"
};
if (this.client.credentials) {
headers.Authorization = "Basic " + (0, _helpers.btoa)(this.client.credentials);
}
fetch(this.client.protocol + "//" + this.client.url + "/" + this.client.appname + "/" + this.path + "?" + _querystring2.default.stringify(this.params), {
method: this.method,
headers: {
"Authorization": "Basic " + (0, _helpers.btoa)(this.client.credentials),
"Accept": "application/json",
"Content-Type": "application/json"
},
headers: headers,
body: this.body

@@ -64,0 +69,0 @@ }).then(function (res) {

@@ -11,2 +11,3 @@ "use strict";

exports.btoa = btoa;
exports.isAppbase = isAppbase;
function validate(object, fields) {

@@ -79,2 +80,10 @@ var invalid = [];

return output;
}
function isAppbase(client) {
return contains(client.url, "scalr.api.appbase.io");
}
function contains(string, substring) {
return string.indexOf(substring) !== -1;
}

@@ -71,2 +71,4 @@ "use strict";

var _helpers = require("./helpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -88,3 +90,3 @@

this.protocol = parsedUrl.protocol;
this.credentials = parsedUrl.auth;
this.credentials = parsedUrl.auth || null;
this.appname = args.appname || args.app;

@@ -100,6 +102,2 @@

if (typeof args.username === "string" && args.username !== "" && typeof args.password === "string" && args.password !== "") {
this.credentials = args.username + ":" + args.password;
}
// credentials can be provided as a part of the URL, as username, password args or

@@ -109,5 +107,7 @@ // as a credentials argument directly

this.credentials = args.credentials;
} else if (typeof args.username === "string" && args.username !== "" && typeof args.password === "string" && args.password !== "") {
this.credentials = args.username + ":" + args.password;
}
if (typeof this.credentials !== "string" || this.credentials === "") {
if ((0, _helpers.isAppbase)(this) && this.credentials === null) {
throw new Error("Authentication information is not present. Did you add credentials?");

@@ -114,0 +114,0 @@ }

@@ -62,6 +62,9 @@ "use strict";

method: this.method,
body: this.body,
authorization: "Basic " + new Buffer(this.client.credentials).toString("base64")
body: this.body
};
if (this.client.credentials) {
this.request.authorization = "Basic " + new Buffer(this.client.credentials).toString("base64");
}
this.resultStream = new _stream2.default();

@@ -68,0 +71,0 @@ this.resultStream.readable = true;

{
"name": "appbase-js",
"version": "2.0.0",
"version": "2.1.0",
"description": "Appbase.io streaming client lib for Javascript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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