mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Rename serveStaticFiles to staticFilesMiddleware
This commit is contained in:
@@ -264,7 +264,7 @@ var getBoilerplate = function (request) {
|
||||
// - staticFiles: object mapping pathname of file in manifest -> {
|
||||
// path, cacheable, sourceMapUrl, type }
|
||||
// - clientDir: root directory for static files from client manifest
|
||||
WebAppInternals.serveStaticFiles = function (options, req, res, next) {
|
||||
WebAppInternals.staticFilesMiddleware = function (options, req, res, next) {
|
||||
if ('GET' != req.method && 'HEAD' != req.method) {
|
||||
next();
|
||||
return;
|
||||
@@ -461,7 +461,7 @@ var runWebAppServer = function () {
|
||||
// Serve static files from the manifest.
|
||||
// This is inspired by the 'static' middleware.
|
||||
app.use(function (req, res, next) {
|
||||
return WebAppInternals.serveStaticFiles({
|
||||
return WebAppInternals.staticFilesMiddleware({
|
||||
staticFiles: staticFiles,
|
||||
clientDir: clientDir
|
||||
}, req, res, next);
|
||||
|
||||
@@ -95,9 +95,10 @@ Tinytest.add("webapp - additional static javascript", function (test) {
|
||||
req.method = "GET";
|
||||
req.url = "/" + additionalScriptPathname;
|
||||
var nextCalled = false;
|
||||
WebAppInternals.serveStaticFiles(staticFilesOpts, req, res, function () {
|
||||
nextCalled = true;
|
||||
});
|
||||
WebAppInternals.staticFilesMiddleware(
|
||||
staticFilesOpts, req, res, function () {
|
||||
nextCalled = true;
|
||||
});
|
||||
test.isTrue(nextCalled);
|
||||
|
||||
// When inline scripts are disallowed, the script body should not be
|
||||
@@ -116,7 +117,7 @@ Tinytest.add("webapp - additional static javascript", function (test) {
|
||||
|
||||
// And the static file handler should serve the script at that pathname.
|
||||
res = new MockResponse();
|
||||
WebAppInternals.serveStaticFiles(staticFilesOpts, req, res,
|
||||
WebAppInternals.staticFilesMiddleware(staticFilesOpts, req, res,
|
||||
function () { });
|
||||
var resBody = res.getBody();
|
||||
test.isTrue(resBody.indexOf(additionalScript) !== -1);
|
||||
|
||||
Reference in New Issue
Block a user