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

json-proxy-middleware

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-proxy-middleware - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

dist/index.d.ts

70

dist/index.js

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

var request_1 = __importDefault(require("request"));
var verror_1 = __importDefault(require("verror"));
// we use these for more accurate timing when logging

@@ -37,17 +38,12 @@ var NS_PER_SEC = 1e9;

if (typeof host !== "string") {
// error, should likely be converted to a VError
next({
errors: [
{
status: 500,
code: "PROXY_HOST_ERROR",
title: "`urlHost` could not be resolved to a valid string.",
detail: "The options.urlHost provided either was not a string, or the value" +
"returned from invoking urlHost() was not a string.",
meta: {
additionalLogMessage: additionalLogMessage || ""
}
next(new verror_1.default({
name: "PROXY_HOST_ERROR",
info: {
detail: "The options.urlHost provided either was not a string, or the value" +
"returned from invoking urlHost() was not a string.",
meta: {
additionalLogMessage: additionalLogMessage || ""
}
]
});
}
}, "`urlHost` could not be resolved to a valid string."));
return;

@@ -79,33 +75,27 @@ }

requestStream.on("error", function (err) {
return next({
errors: [
{
status: 500,
code: "PROXY_REQUEST_ERROR",
title: "There was an error while making the proxied request.",
detail: "The proxied path is " + urlPath + ". The host is " + host + ".",
meta: {
err: err,
url: "" + host + urlPath
}
return next(new verror_1.default({
name: "PROXY_REQUEST_ERROR",
cause: err,
info: {
detail: "The proxied path is " + urlPath + ". The host is " + host + ".",
meta: {
additionalLogMessage: additionalLogMessage || "",
url: "" + host + urlPath
}
]
});
}
}, "There was an error while making the proxied request."));
});
var responseStream = requestStream.pipe(res);
responseStream.on("error", function (err) {
return next({
errors: [
{
status: 500,
code: "PROXY_RESPONSE_ERROR",
title: "There was an error while streaming the response.",
detail: "The proxied path is " + urlPath + ". The host is " + host + ".",
meta: {
err: err,
url: "" + host + urlPath
}
return next(new verror_1.default({
name: "PROXY_RESPONSE_ERROR",
cause: err,
info: {
detail: "The proxied path is " + urlPath + ". The host is " + host + ".",
meta: {
additionalLogMessage: additionalLogMessage || "",
url: "" + host + urlPath
}
]
});
}
}, "There was an error while streaming the response."));
});

@@ -112,0 +102,0 @@ responseStream.on("finish", function () {

{
"name": "json-proxy-middleware",
"version": "0.0.1",
"version": "0.0.2",
"description": "Simple express.js friendly json proxy middleware utility",
"main": "dist/index.js",
"files": [
"dist/"
],
"types": "dist/index.d.ts",
"scripts": {

@@ -30,3 +34,4 @@ "build": "gulp",

"lodash": "^4.17.10",
"request": "^2.87.0"
"request": "^2.87.0",
"verror": "1.10.0"
},

@@ -45,5 +50,4 @@ "devDependencies": {

"tslint-eslint-rules": "5.3.1",
"typescript": "2.9.2",
"verror": "1.10.0"
"typescript": "2.9.2"
}
}
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