Rename serveStaticFiles to staticFilesMiddleware

This commit is contained in:
Emily Stark
2014-06-26 15:15:24 -07:00
parent 53936d3062
commit 168f21654c
2 changed files with 7 additions and 6 deletions

View File

@@ -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);

View File

@@ -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);