-
Notifications
You must be signed in to change notification settings - Fork 984
Open
Description
Bug Report
Restify Version
v7.2.1
Node.js Version
v10.5.0
Expected behaviour
In restify v4, using the serveStatic plugin before including any middleware would not run the middleware when serving a file.
Actual behaviour
Middleware is now run prior to serving files.
Repro case
const restify = require('restify');
const errors = require('restify-errors');
const server = restify.createServer();
server.get('/', restify.plugins.serveStatic({
directory : './public/',
default : 'index.html'
}));
server.use((request, response, next) => {
return next(new errors.ForbiddenError('Nope'));
});
server.get('/api/test', (request, response, next) => {
response.send({});
return next();
});
server.listen(8000);Expected: Request to / serves index.html, request to /api/test gives a ForbiddenError
Actual: Request to both / and /api/test gives a ForbiddenError
Cause
Changes somewhere between v4 and v7, presumably the change in routing/middleware handling.
Are you willing and able to fix this?
No, there appears to be other issues with serveStatic in general so this should be tackled as part of sorting the overall problem out.
Metadata
Metadata
Assignees
Labels
No labels