New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bluecat

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluecat - npm Package Compare versions

Comparing version 0.0.2 to 0.0.4

1

lib/index.js
exports.ServiceSync = require('./service.gen.sync');
exports.Api = require('./service.api');
exports.version = '0.0.4';

15

lib/service.api.js

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

var config = require("config");
var path = require("path");

@@ -14,14 +13,8 @@

// load api from either given file or by default config/api.json
var api = require(file || '../config/api.json');
var apiPath = path.resolve() + path.sep + 'config/api.json';
var api = require(file || apiPath);
// append default config to api
var target = api[name];
target.getPrefix = function() {
return name;
};
target.config = function() {
return config;
};
// if we want to create url on the fly
if(urlCallback){

@@ -35,2 +28,2 @@ return urlCallback(target);

exports.Api = internals.Api;
exports.Api = module.exports = internals.Api;

@@ -15,6 +15,8 @@ /*jshint loopfunc: true */

internals.Service = function(servJson) {
if (servJson === null) {
throw new Error("api.js needed");
internals.Service = function(servJson, host) {
if (host === undefined) {
throw new Error("Missing host when trying to create services...");
}
this.proxy = undefined;
this.host = host;
return this.buildServices(servJson);

@@ -25,27 +27,19 @@ };

internals.Service.prototype.setProxy = function(proxy) {
this.proxy = proxy;
}
internals.Service.prototype.url = function(self) {
// by default url will follow strict restful api protocol
var config = this.config();
if (config) {
// the schema passed in config will overwrite the schema defined in api.json
if (config.server.host.indexOf("http://")===0 || config.server.host.indexOf("https://")===0) {
return config.server.host + (self.path !== "" ? "/" + self.path : "");
} else {
return self.schema + "://" + config.server.host + (self.path !== "" ? "/" + self.path : "");
//return self.schema + "://" + config.server.host + "/" + this.getPrefix() + (self.path != "" ? "/" + self.path : "");
}
// the schema passed in config will overwrite the schema defined in api.json
if (this.host.indexOf("http://")===0 || this.host.indexOf("https://")===0) {
return this.host + (self.path !== "" ? "/" + self.path : "");
} else {
throw new Error("config: function(){} need to be defined in api.js");
return self.schema + "://" + this.host + (self.path !== "" ? "/" + self.path : "");
}
};
internals.Service.prototype.config = function() {
return null;
};
internals.Service.prototype.buildServices = function(services) {
// in case overwritten by api.js
this.url = services.url || this.url;
this.config = services.config;
this.getPrefix = services.getPrefix;

@@ -152,3 +146,3 @@ for (var s in services) {

},
proxy: this.config().server.proxy
proxy: this.proxy
};

@@ -155,0 +149,0 @@

{
"name": "bluecat",
"version": "0.0.2",
"version": "0.0.4",
"description": "REST API test framework in nodejs",

@@ -5,0 +5,0 @@ "repository": {

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