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

faithlife-api

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faithlife-api - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

37

lib/base.js

@@ -7,2 +7,4 @@ /*!

var url = require('url');
var util = require('util');
var express = require('express');
var mi = require('mi');

@@ -74,11 +76,15 @@ var superagent = require('superagent');

BaseApiClient.prototype.request = function request(method, path) {
path = this.getUrl(path);
var start = Date.now();
var href = this.getUrl(path);
console.log('%s %s', method, path);
return superagent(method, path)
return superagent(method, href)
.set('Authorization', this._authorization)
.use(superagentThen)
.on('error', function (err) {
console.error('Error in %s %s: %s', method, path, err);
console.error('Error in %s %s: %s', method, href, err);
})
.on('response', function (res) {
var ms = Date.now() - start;
console.log('%s %s %s %s ms', method, href, res.statusCode, ms.toFixed(3));
});

@@ -125,16 +131,25 @@ };

var self = this;
var app = require('express')();
var app = express();
app.use(function (request, response, next) {
var parsedUrl = url.parse(self.getUrl(request.path));
var start = Date.now();
var href = self.getUrl(request.url);
var parsedUrl = url.parse(href);
var outgoing = https.request({
method: request.method,
hostname: parsedUrl.hostname,
port: parsedUrl.port,
path: parsedUrl.path,
headers: {
'Authorization': request.authorization
}
headers: util._extend(request.headers, {
'Authorization': request.authorization,
'Connection': 'Keep-Alive',
'Host': parsedUrl.host
})
});
outgoing.on('response', function (incoming) {
var ms = Date.now() - start;
console.log('%s %s %s %s ms', request.method, href, incoming.statusCode, ms.toFixed(3));
response.status(incoming.statusCode);

@@ -146,4 +161,2 @@ response.set(incoming.headers);

request.pipe(outgoing);
outgoing.end();
});

@@ -150,0 +163,0 @@

{
"name": "faithlife-api",
"version": "0.4.0",
"version": "0.4.1",
"description": "A collection of CommonJS modules for interacting with the Faithlife API.",
"main": "lib/index.js",
"browser": {
"express": false
},
"scripts": {

@@ -17,3 +20,3 @@ "test": "node test"

"mi": "~1.0.0",
"superagent": "git://github.com/Schoonology/superagent",
"superagent": "~0.19.0",
"superagent-then": "~1.0.0",

@@ -20,0 +23,0 @@ "when": "~3.4.4"

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