Comparing version 1.2.0 to 1.2.1
14
lib/f.js
@@ -54,6 +54,9 @@ 'use strict'; | ||
let fnpath = path.join(process.cwd(), 'f', name, 'index.js'); | ||
let fnjpath = path.join(process.cwd(), 'f', name, 'function.json'); | ||
if (!config.local.cache) { | ||
delete require.cache[require.resolve(fnpath)]; | ||
delete require.cache[require.resolve(fnjpath)]; | ||
} | ||
name = require(fnpath); | ||
name.json = require(fnjpath); | ||
} catch (e) { | ||
@@ -69,3 +72,12 @@ callback(new Error('Could not find local function "' + name + '"')); | ||
params.buffer = payload; | ||
return name(params, callback); | ||
return name(params, (err, result, headers) => { | ||
if (err) { | ||
callback(err); | ||
} | ||
headers = headers || {}; | ||
let oheaders = (name.json && name.json.http && name.json.http.headers) || {}; | ||
oheaders = typeof oheaders === 'object' ? oheaders : {}; | ||
headers = Object.assign(oheaders, headers); | ||
callback(err, result, headers); | ||
}); | ||
} | ||
@@ -72,0 +84,0 @@ |
{ | ||
"name": "f", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Functional Microservice Request Library", | ||
@@ -5,0 +5,0 @@ "main": "lib/f.js", |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
17312
357
5