@google-cloud/functions-framework
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -75,3 +75,3 @@ #!/usr/bin/env node | ||
} | ||
const SERVER = invoker_1.getServer(USER_FUNCTION, SIGNATURE_TYPE, TARGET); | ||
const SERVER = invoker_1.getServer(USER_FUNCTION, SIGNATURE_TYPE); | ||
const ERROR_HANDLER = new invoker_1.ErrorHandler(SERVER); | ||
@@ -78,0 +78,0 @@ SERVER.listen(PORT, () => { |
@@ -112,2 +112,2 @@ /// <reference types="node" /> | ||
*/ | ||
export declare function getServer(userFunction: HandlerFunction, functionSignatureType: SignatureType, functionTarget: string): http.Server; | ||
export declare function getServer(userFunction: HandlerFunction, functionSignatureType: SignatureType): http.Server; |
@@ -346,5 +346,5 @@ "use strict"; | ||
*/ | ||
function registerFunctionRoutes(app, userFunction, functionTarget, functionSignatureType) { | ||
function registerFunctionRoutes(app, userFunction, functionSignatureType) { | ||
if (isHttpFunction(userFunction, functionSignatureType)) { | ||
app.use(`/${functionTarget}`, (req, res, next) => { | ||
app.use('/*', (req, res, next) => { | ||
onFinished(res, (err, res) => { | ||
@@ -355,3 +355,3 @@ res.locals.functionExecutionFinished = true; | ||
}); | ||
app.all(`/${functionTarget}`, (req, res, next) => { | ||
app.all('/*', (req, res, next) => { | ||
const handler = makeHttpHandler(userFunction); | ||
@@ -362,3 +362,3 @@ handler(req, res, next); | ||
else { | ||
app.post(`/${functionTarget}`, (req, res, next) => { | ||
app.post('/*', (req, res, next) => { | ||
const wrappedUserFunction = wrapEventFunction(userFunction); | ||
@@ -413,7 +413,7 @@ const handler = makeHttpHandler(wrappedUserFunction); | ||
*/ | ||
function getServer(userFunction, functionSignatureType, functionTarget) { | ||
function getServer(userFunction, functionSignatureType) { | ||
// App to use for function executions. | ||
const app = express(); | ||
// Set request-specific values in the very first middleware. | ||
app.use(`/${functionTarget}`, (req, res, next) => { | ||
app.use('/*', (req, res, next) => { | ||
latestRes = res; | ||
@@ -430,3 +430,3 @@ res.locals.functionExecutionFinished = false; | ||
app.use(bodyParser.raw(rawBodySavingOptions)); | ||
registerFunctionRoutes(app, userFunction, functionTarget, functionSignatureType); | ||
registerFunctionRoutes(app, userFunction, functionSignatureType); | ||
app.enable('trust proxy'); // To respect X-Forwarded-For header. | ||
@@ -433,0 +433,0 @@ return http.createServer(app); |
@@ -7,2 +7,18 @@ # Changelog | ||
## v1.3.2 | ||
09-13-2019 18:06 PDT | ||
- Revert "fixes [#33](https://github.com/GoogleCloudPlatform/functions-framework-nodejs/pull/33): Only listen to functionTarget. ([#81](https://github.com/GoogleCloudPlatform/functions-framework-nodejs/pull/81))" | ||
### Implementation Changes | ||
### New Features | ||
### Dependencies | ||
### Documentation | ||
### Internal / Testing Changes | ||
## v1.3.1 | ||
@@ -9,0 +25,0 @@ |
{ | ||
"name": "@google-cloud/functions-framework", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "FaaS (Function as a service) framework for writing portable Node.js functions", | ||
@@ -5,0 +5,0 @@ "engines": { |
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
44206