code: function nextCreate(
    filesPromise,
    serveStaticFile,
    serveFile,
    injector,
    basePath,
    urlRoot,
    upstreamProxy
  ) {
    var prevMiddleware = prevCreate(
      filesPromise,
      serveStaticFile,
      serveFile,
      injector,
      basePath,
      urlRoot,
      upstreamProxy
    );
    return function nextMiddleware(request, response, next) {
      var requestUrl = request.normalizedUrl.replace(/\?.*/, '');
      var prevWrite;
      var prevEnd;
      requestUrl = requestUrl.substr(urlRoot.length - 1);
      if (requestUrl === '/context.html' &&
          toplevelScriptIntegrity &&
          toplevelScriptIntegrity.startsWith('sha') &&
          stylesheetIntegrity &&
          stylesheetIntegrity.startsWith('sha')) {
        prevWrite = response.write;
        prevEnd = response.end;
        // eslint-disable-next-line no-param-reassign
        response.write = function nextWrite(chunk, encoding, callback) {
          prevWrite.call(response, addIntegrityTags(chunk), encoding, callback);
        };
        response.end = function nextEnd(chunk, encoding, callback) {
          prevEnd.call(response, addIntegrityTags(chunk), encoding, callback);
        };
      }
      return prevMiddleware(request, response, next);
    };
  }
docs: /*
  Hack Karma to add the integrity attribute to the script tag
  loading the top-level chunk.