const server = new HttpServer();
server.registerDirectory("/", do_get_cwd());
server.registerPathHandler("/cached.json", cacheRequestHandler);
server.start(-1);
add_task(async function test_caching() {
let initialContent = null;
info("Performing the first request.");
await DevToolsUtils.fetch(CACHED_URL).then(({ content }) => {
info("Got the first response: " + content);
initialContent = content;
});
info("Performing another request, expecting to get cached response.");
await DevToolsUtils.fetch(CACHED_URL).then(({ content }) => {
deepEqual(content, initialContent, "The content was loaded from cache.");
});
info("Performing a third request with cache bypassed."); const opts = { loadFromCache: false };
await DevToolsUtils.fetch(CACHED_URL, opts).then(({ content }) => {
notDeepEqual(
content,
initialContent, "The URL wasn't loaded from cache with loadFromCache: false."
);
});
});
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.