Skip to content

Commit 4799207

Browse files
fix: correct handling of IGNORED_ROUTES set to empty
1 parent 356d2b0 commit 4799207

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/server.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,13 @@ export function getServer(
136136
}
137137
if (options.ignoredRoutes !== null) {
138138
// Ignored routes is a configuration option that allows requests to specific paths to be prevented
139-
// from invoking the user's function.
140-
app.use(options.ignoredRoutes, (req, res) => {
141-
res.status(404).send(null);
142-
});
139+
// from invoking the user's function. An empty string indicates that no routes should be filtered.
140+
if (options.ignoredRoutes.trim() !== '') {
141+
// Any non-empty string is the used a route expression to return 404 for.
142+
app.use(options.ignoredRoutes, (req, res) => {
143+
res.status(404).send(null);
144+
});
145+
}
143146
} else if (options.signatureType === 'http') {
144147
// We configure some default ignored routes, only for HTTP functions.
145148
app.use('/favicon.ico|/robots.txt', (req, res) => {

0 commit comments

Comments
 (0)