azure-function-express
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -14,8 +14,28 @@ "use strict"; | ||
const NOOP = () => {}; | ||
const NOOP = () => {}; /* eslint-disable no-underscore-dangle */ | ||
function removePortFromAddress(address) { | ||
return address ? address.replace(/:[0-9]*$/, "") : address; | ||
} | ||
/** | ||
* Create a fake connection object | ||
* | ||
* @param {Object} context Azure context object for a single HTTP request. | ||
* @returns {object} Connection object | ||
*/ | ||
function createConnectionObject(context) { | ||
const req = context.bindings.req; | ||
const xForwardedFor = req.headers ? req.headers["x-forwarded-for"] : undefined; | ||
return { | ||
encrypted: req.originalUrl && req.originalUrl.toLowerCase().startsWith("https"), | ||
remoteAddress: removePortFromAddress(xForwardedFor) | ||
}; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
/* eslint-disable no-underscore-dangle */ | ||
class IncomingMessage extends _events2.default { | ||
@@ -39,2 +59,3 @@ | ||
this.socket = { destroy: NOOP }; | ||
this.connection = createConnectionObject(context); | ||
@@ -41,0 +62,0 @@ // Extra content |
{ | ||
"name": "azure-function-express", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Allows Express usage with Azure Function", | ||
@@ -89,6 +89,6 @@ "keywords": [ | ||
"babel-register": "^6.18.0", | ||
"eslint": "^3.10.2", | ||
"eslint": "^3.11.1", | ||
"eslint-config-airbnb-base": "^10.0.1", | ||
"eslint-plugin-import": "^2.2.0", | ||
"mocha": "^3.1.2", | ||
"mocha": "^3.2.0", | ||
"nyc": "^8.4.0-candidate", | ||
@@ -95,0 +95,0 @@ "rewire": "^2.5.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27043
321